GitHub Actions Configure AWS Credentials

1 min read aws, github, iam

Written in 2021. Tools, APIs and prices may have changed since.

Lab note What I wrote down while learning this by building with it. Short by design; the code is in pfeilbr/github-actions-configure-aws-credentials-playground.

learn aws-actions/configure-aws-credentials

Demo

PROFILE=admin
REGION=us-east-1
STACK_NAME="configure-aws-credentials-playground"

aws cloudformation deploy \
    --profile "${PROFILE}" \
    --region "${REGION}" \
    --stack-name "${STACK_NAME}" \
    --template-file sample-role.yaml \
    --capabilities "CAPABILITY_IAM" "CAPABILITY_NAMED_IAM" \
    --parameter-overrides GitHubOrg=pfeilbr \
        RepositoryName=github-actions-configure-aws-credentials-playground \
#        OIDCProviderArn="arn:aws:iam::123456789012:oidc-provider/vstoken.actions.githubusercontent.com"

# run workflow manually
gh workflow run default.yml

# list runs
gh run list --workflow=default.yml

# show run details 
gh run view <run-id>

# delete stack
aws cloudformation delete-stack \
    --profile "${PROFILE}" \
    --region "${REGION}" \
    --stack-name "${STACK_NAME}"

successful workflow run with aws sts get-caller-identity

Resources

Keep learning

Get new guides and courses by email

An occasional email when I publish a new guide, course or post. No spam, and you can unsubscribe any time.

Sent with Buttondown. I never share your address. Prefer a feed? Use the RSS feed.