Skip to content

Instantly share code, notes, and snippets.

@achmat-samsodien
Created March 24, 2020 05:41
Show Gist options
  • Save achmat-samsodien/38919d36c06aa303a29d01119287bf85 to your computer and use it in GitHub Desktop.
Save achmat-samsodien/38919d36c06aa303a29d01119287bf85 to your computer and use it in GitHub Desktop.
IAM Roles in Gitlab Runner
export AWS_CREDS=$(curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/<iam-role>)
export AWS_SECRET_ACCESS_KEY=$(echo $AWS_CREDS | jq -r ".SecretAccessKey")
export AWS_ACCESS_KEY_ID=$(echo $AWS_CREDS | jq -r ".AccessKeyId")
export AWS_SESSION_TOKEN=$(echo $AWS_CREDS | jq -r ".Token")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment