aws-cli

AWS ec2 describe-instance-status only for instances with events

为君一笑 提交于 2019-12-25 07:26:37
问题 Is there a easy way to run aws ec2 describe-instance-status and only display the information of instances if they have any Scheduled Events? 回答1: You can use the --query arg for this: $ aws ec2 describe-instance-status --query 'InstanceStatuses[?length(Events || `[]`) > `0`]' 回答2: Or you can use --filter CLI argument for this: $ aws ec2 describe-instance-status --filters "Name=event.code,Values='instance-reboot','system-reboot','system-maintenance','instance-retirement','instance-stop'" This

Query storage status on an RDS DB using AWS CLI

一笑奈何 提交于 2019-12-25 04:54:09
问题 I have a few RDS servers I'd like to monitor for insufficient disk space. For simplicity sake, I prefer using my current monitoring system rather than an AWS solution like cloudwatch. I've been reading the documentation and the nearest solution was describe-db-instances, which gives the allocated storage, but not the space left / amount of storage used: "SecondaryAvailabilityZone": "us-east-1a", "ReadReplicaDBInstanceIdentifiers": [], "AllocatedStorage": 100, ... How do I query a specific RDS

Given a failed AWS API request, how can I debug what permissions I need?

耗尽温柔 提交于 2019-12-25 01:06:14
问题 I'm using Terraform to provision some resources on AWS. Running the "plan" step of Terraform fails with the following vague error (for example): Error: Error loading state: AccessDenied: Access Denied status code: 403, request id: ABCDEF12345678, host id: SOMELONGBASE64LOOKINGSTRING=== Given a request id and a host id is it possible to see more in depth what went wrong? Setting TF_LOG=DEBUG (or some other level) seems to help, but I was curious if there is a CLI command to get more

AWS CLI file extension association warning on Windows

泄露秘密 提交于 2019-12-24 19:10:52
问题 Using aws cli with pythno 3 on Windows, always getting a warning, but the program runs well after this message. For example: >>> aws --version --debug Не найдено сопоставление для расширения имени файла .py. aws-cli/1.15.83 Python/3.6.0 Windows/7 botocore/1.10.82 (vaguely -' Cannot find association for filename extension .py') Any idea which part of aws scripts issues this warning and how to fix it? At what part does aws use Windows call? 回答1: As @Evgeny describes in Windows after install AWS

aws s3 > is “aws s3 cp” command implemented with multithreads?

∥☆過路亽.° 提交于 2019-12-24 05:46:56
问题 I am newbie in using aws s3 client. I tried to use "aws s3 cp" command to download batch of files from s3 to local file system, it is pretty fast. But I then tried to only read all the contents of the batch of files in a single thread loop by using the amazon java sdk API, it is suprisingly several times slower then the given "aws s3 cp" command :< Anyone know what is the reason? I doubted that "aws s3 cp" is multi-threaded 回答1: If you looked at the source of transferconfig.py , it indicates

Bash script failing with unknown option due to space in argument

混江龙づ霸主 提交于 2019-12-24 03:29:06
问题 I am trying to run aws create lambda function. It goes as follows - eval $(aws lambda create-function \ --function-name $FUNCTION_NAME \ --runtime $RUNTIME \ --role $ROLE \ --handler $HANDLER \ --region $REGION \ --zip-file $ZIP_FILE \ --profile $PROFILE \ --environment $env_variables) All the variables come from command line. It is failing for env_variables. This gets constructed as - env_variables="Variables={INPUT=${DAYS}}" where DAYS is actually "20 days" How can I avoid this space and

Get AWS IAM policy Access Advisor records from CLI or SDK

混江龙づ霸主 提交于 2019-12-24 01:24:26
问题 I'm reviewing IAM policies and roles that haven't been used in the last N number of days. In the console I can easily view recent usage under Access Advisor. I'd like to get the same in an automated way, but I can't find any documentation on getting this using CLI or SDK. Is this possible? 回答1: It is now available, check the link below https://aws.amazon.com/about-aws/whats-new/2018/12/iam_access_advisor_apis/ 回答2: Netflix has a tool called Aardvark to scrape the Access Advisor data from the

Get AWS IAM policy Access Advisor records from CLI or SDK

吃可爱长大的小学妹 提交于 2019-12-24 01:21:07
问题 I'm reviewing IAM policies and roles that haven't been used in the last N number of days. In the console I can easily view recent usage under Access Advisor. I'd like to get the same in an automated way, but I can't find any documentation on getting this using CLI or SDK. Is this possible? 回答1: It is now available, check the link below https://aws.amazon.com/about-aws/whats-new/2018/12/iam_access_advisor_apis/ 回答2: Netflix has a tool called Aardvark to scrape the Access Advisor data from the

Access Denied when creating CloudFront invalidation with AWS CLI

Deadly 提交于 2019-12-23 12:16:41
问题 I'm using the AWS CLI to create a CloudFront distribution in a script: aws configure set preview.cloudfront true aws cloudfront create-invalidation --distribution-id ABCD1234 --paths '/*' I have a policy set up with this statement: { "Sid": "xxx", "Effect": "Allow", "Action": [ "cloudfront:CreateInvalidation" ], "Resource": [ "arn:aws:cloudfront::xxx:distribution/ABCD1234" ] } The policy is attached to the user that is running the command. However, I still get this error: A client error

Can I specify a default AWS configuration profile?

爷,独闯天下 提交于 2019-12-23 09:37:35
问题 In my development environment, I regularly switch between several AWS access keys. So in my ~/.aws/credentials file, I have several profiles. I can then use these profiles with aws-cli by specifying the --profile <name> flag. I develop several apps that use the Ruby AWS SDK. They are setup to read credentials from the ~/.aws/credentials file (the SDK does this by default, see this configuration article). The problem is that the SDK always reads from the default profile. I would like to be