AWS CLI EC2: option modify-default-credit-specification not working - amazon-web-services

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

Related

Error "Unknown options: AutoImportPolicy=DELETED], AutoImportPolicy=CHANGED" while creating AWS FSx create-data-repository-association

I am getting error while adding auto-import-policy when creating AWS FSx create-data-repository-association
FSX Lustre config is:
Storage type: SSD
Deployment type: Persistent 2
Lustre version: 2.12
Success: The below command is successful
aws --region region_name fsx create-data-repository-association --file-system-id fs-xxxxxxxxxxx --batch-import-meta-data-on-create --file-system-path /ns1/ --data-repository-path s3://s3_bucket_path --s3 AutoImportPolicy={Events=[NEW]},AutoExportPolicy={Events=[NEW]}
Error: throwing error when taking multiple options in the list of the AutoImportPolicy
aws --region region_name fsx create-data-repository-association --file-system-id fs-xxxxxxxxx --batch-import-meta-data-on-create --file-system-path /ns1/ --data-repository-path s3://s3_bucket_path --s3 AutoImportPolicy={Events=[NEW,CHANGED,DELETED]}
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: AutoImportPolicy=DELETED], AutoImportPolicy=CHANGED
I tried the below options but none of them are successful
--s3 AutoImportPolicy={Events=['NEW','CHANGED','DELETED']}
--s3 AutoImportPolicy={Events=["NEW","CHANGED","DELETED"]}
--s3 AutoImportPolicy={Events=[NEW|CHANGED|DELETED]}
--s3 AutoImportPolicy={Events=[NEW_CHANGED_DELETED]}
but none of the above options worked
Expecting: I am expecting to create the data-repository-association whose AutoImportPolicy should be New,Changed & deleted
the issue is fixed by using the below command:
aws --region ${AWS_REGION} fsx create-data-repository-association \
--batch-import-meta-data-on-create \
--file-system-id ${fsx_id} \
--file-system-path /ns1/ \
--data-repository-path ${s3_dra} \
--s3 "AutoImportPolicy={Events=[NEW,CHANGED,DELETED]},AutoExportPolicy={Events=[NEW,CHANGED,DELETED]}"

Retrieve public key via AWS CLI

I tried to retrieve the public key content via aws cli following https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-key-pairs.html. But it didn't work.
aws ec2 describe-key-pairs --key-name mykey --include-public-key
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: --include-public-key

AWS coiffure stopped working. CI/CD gitlab.com

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 :)

AWS Translate | Asynchronous Batch Processing | CLI | describe-text-translation-job not valid command

I have installed and configure AWS CLI both my windows 10 machine and AWS EC2 Linux machine also have one AWS translated batch job in frankfurt aws region. I am following this document for to initiate the batch translation process using CLI. https://docs.aws.amazon.com/translate/latest/dg/translate-dg.pdf
Now, suppose I am using this sample command
aws translate describe-text-translation-job --job-id xxxxxxx
I am getting this error everyplace
[ec2-user#ip-xx-xx-xx-xx ~]$ aws translate describe-text-translation-job --job-id xxxxxxx
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:
delete-terminology | get-terminology
import-terminology | list-terminologies
translate-text | help
It only show 5 valid choice other than help but as per the documentation it should be more
https://docs.aws.amazon.com/cli/latest/reference/translate/index.html#cli-aws-translate
why I am not getting these options
describe-text-translation-job
start-text-translation-job
stop-text-translation-job
list-text-translation-jobs
It was AWS CLI version problem only, I updated the version and now I get all the required methods.

aws cli --profile expected one parameter

I am trying to use --profile with aws-cli
$ aws s3 ls --profile profile360
Works good, but:
$ aws dynamodb scan --table-name dev_eventsApi_EventsTable --output > c:\temp\hevo.txt --profile profile360
results in
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 --output: expected one argument
I encounter cases where I have problems working with --profile
What am I doing wrong?
Define the type of output, for example, text or json. Try this.
aws dynamodb scan --table-name dev_eventsApi_EventsTable --output text --profile profile360 > c:\temp\hevo.txt