I'm using GitLab CI tool and was using this script for a few months with no problems at all:
- curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
- unzip awscli-bundle.zip
- ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
- aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
- aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
- aws configure set region us-east-1
...
This worked fine before, but yesterday it started to give this error on aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID line:
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
usage:
Note: AWS CLI version 2, the latest major version of the AWS CLI, is now stable and recommended for general use. For more information, see the AWS CLI version 2 installation instructions at: https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html
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: the following arguments are required: value
I'm sure I'm using awscli1
Would be very grateful for some help :)
Related
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.
amazon/aws-cli docker has set entrypoint to aws as it's expected to be executed as
$ docker run amazon/aws-cli cloudfront create-invalidation --distribution-id ...
but gitlab expects entry point to shell so it can then execute script commands.
Check out gitlab documentation: https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#available-settings-for-image
You will find there how to override docker image entrypoint.
Working config is:
image:
name: amazon/aws-cli:2.2.18
entrypoint: [""]
It says in the EC2 userguide that you can change the t2/t3/t3a default-credit-specification for your AWS account Link Here.
When I run the command aws ec2 modify-default-credit-specification --region us-east-1 --instance-family t2 —-cpu-credits unlimited, it says Invalid choice: 'modify-default-credit-specification'. How do I change the default specification of t2/t3/t3a instances
Try updating your aws cli to the latest version.
$ aws --version
aws-cli/1.14.44 Python/3.6.8 Linux/4.15.0-72-generic botocore/1.8.48
$ aws ec2 modify-default-credit-specification
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 operation: Invalid choice, valid choices are:
...
but
$ ~/.local/bin/aws --version
aws-cli/1.16.309 Python/3.6.8 Linux/4.15.0-72-generic botocore/1.13.45
$ ~/.local/bin/aws ec2 modify-default-credit-specification
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: the following arguments are required: --instance-family, --cpu-credits
This command will work in AWS CLI version 2.
Link to download/install -> https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-windows.html'
Command to check default CPU Level credits:-
aws ec2 --region us-west-2 get-default-credit-specification --instance-family t3
Command to disable at account level for Oregon Region:
aws ec2 modify-default-credit-specification --region us-west-2 --instance-family t3 --cpu-credits standard
I am using AWS sam to package and deploy my lambda functions. But I found the sam command doesn't work well in ubuntu linux.
Below is the output of sam package command from ubuntu-16.04. It looks like the command arguments error but the same command can be run on Mac. I don't know what wrong with this command.
$ sam package --template-file sam.yaml --s3-bucket mybucket --output-template-file packaged.yaml
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 operation: Invalid choice, valid choices are:
...
$ sam --version
SAM CLI, version 0.16.0
It turns out that the problem was that the awscli version was too old. Solved it by upgrading awscli since it is used underneath.
I have a normal CodeDeploy package which is able to deployed using the Console without any issues, but when using the CLI, I get a weird error.
aws deploy create-deployment --application-name MyApp --s3-location bucket=mybucket,key=My.Zip.1.1.1.zip,bundleType=zip --deployment-group-name MyDeploymentGroup --deployment-config-name CodeDeployDefault.OneAtATime --description "This throwns an error"
Running the above, I get the following returned:
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:
aws help
aws <command> help
aws <command> <subcommand> help
Unknown options: bundleType=zip, key=My.Zip.1.1.1.zip
Weird, since the help does say you need bundleType and key in the s3-location parameter. Just as a test, I remove these unknown options:
aws deploy create-deployment --application-name MyApp --s3-location bucket=mybucket --deployment-group-name MyDeploymentGroup --deployment-config-name CodeDeployDefault.OneAtATime --description "This throwns an error"
Which returns:
--s3-location must specify bucket, key and bundleType.
So, now you know of these options and require them? What is going on here? Am I missing something obvious?
When I ran the code you provided, I got the following returned:
$ aws --version
aws-cli/1.10.60 Python/2.7.11 Darwin/15.6.0 botocore/1.4.50
$ aws deploy create-deployment --application-name ...snip
An error occurred (ApplicationDoesNotExistException) when calling the CreateDeployment operation: No application found for name: MyApp
And this(AWS server side error) is the expected behaviour(I guess).
One possibility that your CLI raised the validation error is that your AWS CLI is out of date.
Which version is your AWS CLI?
I had the same issue. It seemed to be related to the version of PowerShell. It worked on v5, but not on v4.
To fix it, I just put double quotes around the s3-location argument:
aws deploy create-deployment --application-name MyApp --s3-location "bucket=mybucket,key=My.Zip.1.1.1.zip,bundleType=zip" --deployment-group-name MyDeploymentGroup --deployment-config-name CodeDeployDefault.OneAtATime --description "This throwns an error"
I'm trying to install Kubernetes (first time) on AWS according to this tutorial http://kubernetes.io/docs/getting-started-guides/aws/#prerequisites
I can use the AWS CLI but after running the following command:
export KUBERNETES_PROVIDER=aws; curl -sS https://get.k8s.io | bash
Then I get this error:
Unpacking kubernetes release v1.3.0
Creating a kubernetes on aws...
... Starting cluster in us-west-2a using provider aws
... calling verify-prereqs
... calling kube-up
Starting cluster using os distro: jessie
usage: aws [options] <command> <subcommand> [parameters]
aws: error: argument subcommand: Invalid choice, valid choices are:
list
Uploading to Amazon S3
+++ Staging server tars to S3 Storage: kubernetes-staging-a9b7435c8fc7b6c3d3e26fdd5b84aaae/devel
usage: aws [options] <command> <subcommand> [parameters]
aws: error: argument --region: expected one argument
any help/insight appreciated..
I had the same issue; it turned out I had pip install aws not pip install awscli. After uninstalling aws and installing awscli I was good to go.
Seems region is missing from environment vars.
Below example is env vars for Singapore region
export KUBE_AWS_ZONE=ap-southeast-1a
export NUM_NODES=2
export MASTER_SIZE=t2.micro
export NODE_SIZE=t2.micro
export AWS_S3_REGION=ap-southeast-1
export AWS_S3_BUCKET=mudrii-kubernetes-artifacts
export KUBE_AWS_INSTANCE_PREFIX=k8s