When deploying to AWS infrastructure, we do the authentication (configure) for our aws cli. There are options we can do to authenticate.
use interactive `aws configure`
use environment variables `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`
use `aws configure set`
The first option is not applicable for our CI/CD case as it requires user input.
The second option should work, but for wired reason, it show:
An error occurred (IncompleteSignature) when calling the CreateInvalidation operation:...
The thrid options works like charm. Here are the steps you might take:
- Define variables in your CI/CD tool for both access key and secret. Do use _AWS_ACCESS_KEY_ID instead of AWS_ACCESS_KEY_ID as the CI/CD session will use the second option
- set configuration:
aws configure set aws_access_key_id ${_AWS_ACCESS_KEY_ID}
aws configure set aws_secret_access_key ${_AWS_SECRET_ACCESS_KEY}
Voila! Problem solved.