Created
October 19, 2020 05:43
-
-
Save AndrewFarley/6ad7b080a777cb21f89be2a3c413cd1c to your computer and use it in GitHub Desktop.
Gitlab Runner ec2 autoscaling userdata - auto-renew ecr credentials/access
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
apt update -y && apt install awscli make joe -y | |
mkdir -p ~/.aws/ | |
cat > ~/.aws/config <<EOL | |
[default] | |
region = us-east-2 | |
aws_access_key_id = TODOTODO | |
aws_secret_access_key = TODOTODO | |
EOL | |
aws ecr get-login --region us-east-2 | sed 's/-e none//' | bash | |
cat > /etc/cron.hourly/aws-docker-ecr <<EOL | |
#!/bin/sh | |
aws ecr get-login --region us-east-2 | sed 's/-e none//' | bash | |
EOL | |
chmod 755 /etc/cron.hourly/aws-docker-ecr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment