Welcome to the AWS Authentication Scripts repository! This project contains PowerShell scripts designed to streamline the authentication process for AWS services like CodeArtifact and ECR. These scripts will help you log into each service and update necessary tokens or credentials, with detailed logging for easy auditing and troubleshooting.
- Authenticate and log into AWS CodeArtifact repositories.
- Authenticate Docker with AWS ECR.
- Cross-platform compatibility (Windows, macOS, and Linux).
- AWS CLI installed and configured. For more information, refer to the AWS CLI Installation Guide and Configuring the AWS CLI.
- Docker installed (for ECR authentication).
- PowerShell Core (7.x) installed.
- Access to the AWS CodeArtifact and ECR services.
- Proper configuration of AWS credentials and region.
- Clone or download the repository containing the scripts.
- Open PowerShell Core and navigate to the directory containing the
refreshNugetTokens.ps1
script. - Run the script using the following command:
.\refreshNugetTokens.ps1
- Open PowerShell Core and navigate to the directory containing the
refreshEcrDockerToken.ps1
script. - Run the script using the following command:
.\refreshEcrDockerToken.ps1
To ensure that your development machine is always authenticated with the necessary services, feel free to add these scripts to your cron jobs (Linux/macOS) or Task Scheduler (Windows). This way, you can automate the authentication process to run at startup or at regular intervals.
- Open your crontab configuration:
crontab -e
- Add the following line to run the script at startup (adjust the path as needed):
@reboot pwsh /path/to/the/repository/refreshNugetTokens.ps1
@reboot pwsh /path/to/the/repository/refreshEcrDockerToken.ps1
-
Open Task Scheduler and create a new task.
-
Set the trigger to run the task at login.
-
Set the action to start a program and use the following settings:
"pwsh C:\path\to\the\repository\refreshNugetTokens.ps1"
-
same for the other scripts if you need it.
Both scripts contain configuration variables that can be modified as needed:
- REGION: The AWS region where the service is hosted. Default is
us-east-1
. - DEBUG: Boolean to enable or disable debug mode. Default is
false
.
# start Configuration
$REGION = "us-east-1"
$DEBUG = $false
# end Configuration
Currently, this repository includes authentication scripts for AWS CodeArtifact and AWS ECR. If you have other authentication mechanisms to add, feel free to contribute!
This project is licensed under the MIT License. See the LICENSE file for details.
Hi, I'm Karim Zouine, the developer of these scripts. Contributions are very welcome! If you have suggestions, improvements, or bug fixes, please open an issue or submit a pull request. Let's make this project even better together!