Skip to content

Instantly share code, notes, and snippets.

@AndrewFarley
Created October 19, 2020 05:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndrewFarley/6ad7b080a777cb21f89be2a3c413cd1c to your computer and use it in GitHub Desktop.
Save AndrewFarley/6ad7b080a777cb21f89be2a3c413cd1c to your computer and use it in GitHub Desktop.
Gitlab Runner ec2 autoscaling userdata - auto-renew ecr credentials/access
#!/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