I'm trying to run the aws command (to invalidate cloudfront) using official aws image and have the following config of .gitlab-ci.yml:
static-invalidation:
<<: *production-env
stage: static_invalidation
image: amazon/aws-cli:latest
variables:
AWS_ACCESS_KEY_ID: $CLOUDFRONT_AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $CLOUDFRONT_AWS_SECRET_ACCESS_KEY
script:
- aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION --invalidation-batch file://deployment/configs/inv-batch.json
The job fails with the following error:
Using docker image sha256:00cf4f100b03d1b26e93cce377c1311c34efa753e379cd5c6ea5d458337cbaab for amazon/aws-cli:2.2.17 with digest amazon/aws-cli@sha256:39e9898fc43f618636a2190f82b9babcdc618d054e66b49c9959b9cd23285ade ...
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:
aws help
aws <command> help
aws <command> <subcommand> help
aws: error: argument command: Invalid choice, valid choices are:
accessanalyzer | acm
acm-pca | alexaforbusiness
...
ERROR: Job failed: exit code 252
Any ideas why it's not working? When I run the command locally it works.