AWS CLI(aws rds) Unknown Option : --cloudwatch-logs-export-configuration - amazon-web-services

I am trying to run aws cli to enable Postgres RDS log files export to cloudwatch(for longer retention and dashboards)
The command I ran :
aws rds modify-db-instance --db-instance-identifier --cloudwatch-logs-export-configuration '{"EnableLogTypes":["postgres", "upgrade"]}'
I get error :
Unknown options: --cloudwatch-logs-export-configuration
In AWS documentation this is a suggested command, but in 'aws help' this option is not documented.

Try updating the CLI version
1.11.139 is the latest version of awscli
if you are using pip, proceed with pip (or) pip3 install awscli --upgrade

Related

Why is the aws cli not found on amazonlinux2 ami?

The AmazonLinux2 AMI I am using for my Docker hosts does not appear to have the AWS CLI installed. The log has an error from the user data script that tries to run an aws command:
/var/lib/cloud/instance/scripts/part-001: line 7: aws: command not found
Then I connected with SSH to the instance for a sanity check, and aws is definitely not found:
[ec2-user#ip-X-X-X-X ~]$ cat /etc/os-release
NAME="Amazon Linux"
VERSION="2"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2"
PRETTY_NAME="Amazon Linux 2"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"
HOME_URL="https://amazonlinux.com/"
[ec2-user#ip-X-X-X-X ~]$ aws --version
-bash: aws: command not found
I thought the AWS CLI was installed by default on all AmazonLinux AMIs? I don't remember ever having to install it myself before.
This article even says that the CLI v1 is installed by default on AmazonLinux2:
AWS Docs Link
So how is it possible that it's not found on this stock AMI? Do only some of the AmazonLinux2 AMIs have the CLI pre-installed? For reference, I am using this AMI:
amzn2-ami-minimal-hvm-2.0.20200917.0-x86_64-ebs (ami-0a6993b2978bd23cb)
From this post on AWS forum:
Minimal has a smaller set of packages installed by default. For example, a lot of AWS specific packages are installed on the default for easy integration to other AWS services. The minimal do not have these installed. This gives a much lower footprint for those who are not directly interacting with other AWS services, or who want to cherry-pick which ones they install.
If you want awscli, you can install it:
sudo yum install -y awscli
to install the latest version of the awscli (v2) see this doc
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

s3 intelligent tiering, getting storage-class invalid choice at CLI

Update - how to upgrade aws cli? my attempts failed.
I get the following.
I've tried different regions and intelligent tiering works ok in the management console UI. But using the CLI I get:
$ aws s3 cp aws_aliases.sh --storage-class INTELLIGENT_TIERING s3://snap2web1
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 --storage-class: Invalid choice, valid choices are:
STANDARD | REDUCED_REDUNDANCY
STANDARD_IA
I tried updating my aws cli but that didn't help:
$ aws --version
aws-cli/1.14.44 Python/3.6.8 Linux/4.15.0-65-generic botocore/1.8.48
$ pip install --upgrade awscli
Collecting awscli
...
$ aws --version
aws-cli/1.14.44 Python/3.6.8 Linux/4.15.0-65-generic botocore/1.8.48
I tried upgrading my aws version from 1.44 to 1.61 but
$ pip install --upgrade awscli
didn't do it.
I then removed awscli and reinstalled it but I still get 1.44
How to upgrade ?
Update: After update (sudo snap install aws-cli --classic):
$ aws --version
aws-cli/1.16.148 Python/3.6.7 Linux/4.15.0-65-generic botocore/1.12.138
You may be using an outdated version of the cli, please upgrade. What version are you using?
aws --version
Support for intelligent tier was added in version 1.16.61 of the aws cli as can be seen in the Github project.

AWS QuickSight Embedding CLI error - aws: error: argument command: Invalid choice, valid choices are:

I am trying to embed a QuickSight Dashboard and am following the current steps.
https://aws.amazon.com/blogs/big-data/embed-interactive-dashboards-in-your-application-with-amazon-quicksight/
I'm at step 3 and able to assume the role and,
export AWS_ACCESS_KEY_ID="access_key_from_assume_role"
export AWS_SECRET_ACCESS_KEY="secret_key_from_assume_role "
export AWS_SESSION_TOKEN="session_token_from_assume_role"
However when I try and do the next step of calling "aws quicksight ..." from the next part I'm getting the following error,
aws: error: argument command: Invalid choice, valid choices are:
I've installed pip and made sure the command line text matches with correct details.
Has anyone experienced this or has any ideas why aws quicksight command wouldn't be working in the CLI?
Check AWS CLI version:
aws --version
It looks like the AWS CLI needs update.
To upgrade an existing AWS CLI installation, use the --upgrade option:
pip install --upgrade awscli
If you have pip3 then.
pip3 install --upgrade awscli
or
sudo pip3 install --upgrade awscli
Also remember that aws sts assume-role --role-arn has expiry token, to need to run this command again to get AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_SESSION_TOKEN to continue.
What I did was I, I prepared a tempprofile for these credentials and used this profile in next aws quicksight commands.
e.g
aws configure set AWS_ACCESS_KEY_ID XXXXXXX --profile tempprofile
aws configure set AWS_SECRET_ACCESS_KEY XXXXXXXX--profile tempprofile
aws configure set AWS_SESSION_TOKEN XXXXXXX --profile tempprofile
In my case also I set
aws configure set REGION ap-southeast-2 --profile tempprofile
and then in next aws quicksight commands use --profile tempprofile

How can i Configure aws cli profile with Elastic Beanstack?

I am using Elastic Beanstack for deploying my application. During deploying I have to run some command. So I have prepare .ebextensions script for it. which my script does
python (pip)
aws cli
and some aws command which i need to configure the aws profile (aws configure)
So how can I configure the aws profile with Elastic Beanstack in batch script in .ebextensions.
Elastic Beanstalk uses a different program for the command line interface.
To install awsebcli for Linux:
pip install awsebcli --upgrade --user
For Windows:
Install Python, pip, and the EB CLI on Windows

"aws s3 ls" command throwing "InvalidRequest" error message. How to solve it?

After I run aws s3 ls command I get below error message:-
A client error (InvalidRequest) occurred when calling the ListBuckets
operation: You are attempting to operate on a bucket in a region that
requires Signature Version 4. You can fix this issue by explicitly
providing the correct region location using the --region argument, the
AWS_DEFAULT_REGION environment variable, or the region variable in the
AWS CLI configuration file. You can get the bucket's location by
running "aws s3api get-bucket-location --bucket BUCKET".
Below are more details and my findings that may help to answer the question:-
The command is being executed from an EC2 Instance running in ap-south-1 region.
This Amazon doc says that new region created after Jan 30 2014 only support Signature Version 4.
As suggested by error message I tried giving command aws --region ap-south-1 s3 ls but the this command also gives the same error message.
I have run yum update and the AWS CLI version is latest which is aws-cli/1.10.33 Python/2.7.10 Linux/4.4.11-23.53.amzn1.x86_64 botocore/1.4.23
The above aws s3 ls command works absolutely fine and lists the buckets if it is executed from an us-east-1 instance.
You need to update aws cli to latest version(v1.11.84 at the time of writing).
If yum update is not working then try following this Guide to install AWS CLI
The reason behind this error is, in newer regions AWS S3 doesn't support Lower Signature Version.
This worked for me:
sudo pip install --upgrade awscli
For Mac do sudo pip install awscli and that should fix the issue.