aws-cli

Getting Outputs from aws cloudformation describe-stacks

99封情书 提交于 2019-11-28 20:08:01
I am using the below to get the stack information I want via AWS Cli: aws cloudformation --region ap-southeast-2 describe-stacks --stack-name mystack It's returning result OK: { "Stacks": [ { "StackId": "arn:aws:mystackid", "LastUpdatedTime": "2017-01-13T04:59:17.472Z", "Tags": [], "Outputs": [ { "OutputKey": "Ec2Sg", "OutputValue": "sg-97e13dff" }, { "OutputKey": "DbUrl", "OutputValue": "myUrl" } ], "CreationTime": "2017-01-13T03:27:18.893Z", "StackName": "mystack", "NotificationARNs": [], "StackStatus": "UPDATE_ROLLBACK_COMPLETE", "DisableRollback": false } ] } But I do not know how to

List public IP addresses of EC2 instances

强颜欢笑 提交于 2019-11-28 20:07:08
I want to list the public IP addresses of my EC2 instances using Bash, separated by a delimiter (space or a new-line). I tried to pipe the output to jq with aws ec2 describe-instances | jq , but can't seem to isolate just the IP addresses. Can this be done by aws alone, specifying arguments to jq , or something else entirely? Directly from the aws cli : aws ec2 describe-instances \ --query "Reservations[*].Instances[*].PublicIpAddress" \ --output=text A Null Pointer The below command would list the IP addresses of all your running EC2 instances aws ec2 describe-instances | grep PublicIpAddress

How to test credentials for AWS Command Line Tools

人盡茶涼 提交于 2019-11-28 16:16:35
Is there a command/subcommand that can be passed to the aws utility that can 1) verify that the credentials in the ~/.aws/credentials file are valid, and 2) give some indication which user the credentials belong to? I'm looking for something generic that doesn't make any assumptions about the user having permissions to IAM or any specific service. The use case for this is a deploy-time sanity check to make sure that the credentials are good. Ideally there would be some way to check the return value and abort the deploy if there are invalid credentials. Use GetCallerIdentity : aws sts get

How to change User Status FORCE_CHANGE_PASSWORD?

霸气de小男生 提交于 2019-11-28 15:38:35
Using AWS Cognito, I want to create dummy users for testing purposes. I then use the AWS Console to create such user, but the user has its status set to FORCE_CHANGE_PASSWORD . With that value, this user cannot be authenticated. Is there a way to change this status? UPDATE Same behavior when creating user from CLI Ionut Trestian Sorry you are having difficulties. We do not have a one step process where you can just create users and authenticate them directly. We might change this in the future such as to allow administrators to set passwords that are directly usable by users. For now, when you

Executing AWS CLI command from php results in Unable to locate credentials

ε祈祈猫儿з 提交于 2019-11-28 13:27:08
I am trying to run aws s3 cp command from within php code using shell exec. Following is the php code. echo shell_exec("sudo aws s3 cp s3://<bucket>/somefolder/somefile s3://<bucket>/someotherfolder/somefile --region ap-southeast-1 --acl public-read"); The file is not getting copied and The output from echo is the following "Unable to locate credentials Completed 1 part(s) with ... file(s) remaining" Note1: I have already set the credentials using aws configure command Note2: If I run the exact same command directly from terminal, it works fine. Any idea? The AWS CLI sets credentials at ~/.aws

Elastic Beanstalk “git aws.push” only commited difference?

左心房为你撑大大i 提交于 2019-11-28 04:56:50
问题 We are storing our PHP project on github. For fast deployment we are using .bat file for git pushing changes to AWS Elastic Beanstalk cloud: "C:\Program Files (x86)\Git\bin\sh.exe" --login -i -c "git aws.push --environment envname" We are making commit every time before push, and it's working just perfect, as expected. Unfortunately, for some reason, sometime it is pushing really quick (just pushing difference in PHP Code changes), but sometimes it is sending whole 300mb project (with all

How to upgrade AWS CLI to the latest version?

拟墨画扇 提交于 2019-11-28 04:36:19
I recently noticed that I am running an old version of AWS CLI that is lacking some functionality I need: $aws --version aws-cli/1.2.9 Python/3.4.3 Linux/3.13.0-85-generic How can I upgrade to the latest version of the AWS CLI (1.10.24)? Edit: Running the following command fails to update AWS CLI: $ pip install --upgrade awscli Requirement already up-to-date: awscli in /usr/local/lib/python2.7/dist-packages Cleaning up... Checking the version: $ aws --version aws-cli/1.2.9 Python/3.4.3 Linux/3.13.0-85-generic To upgrade AWS CLI just use $ pip install --upgrade awscli From http://docs.aws

AWS CLI S3 A client error (403) occurred when calling the HeadObject operation: Forbidden

白昼怎懂夜的黑 提交于 2019-11-27 21:48:33
I'm trying to setup a Amazon Linux AMI(ami-f0091d91) and have a script that runs a copy command to copy from a S3 bucket. aws --debug s3 cp s3://aws-codedeploy-us-west-2/latest/codedeploy-agent.noarch.rpm . This script works perfectly on my local machine but fails with the following error on the Amazon Image: 2016-03-22 01:07:47,110 - MainThread - botocore.auth - DEBUG - StringToSign: HEAD Tue, 22 Mar 2016 01:07:47 GMT x-amz-security-token:AQoDYXdzEPr//////////wEa4ANtcDKVDItVq8Z5OKms8wpQ3MS4dxLtxVq6Om1aWDhLmZhL2zdqiasNBV4nQtVqwyPsRVyxl1Urq1BBCnZzDdl4blSklm6dvu+3efjwjhudk7AKaCEHWlTd

The AWS Access Key Id does not exist in our records

耗尽温柔 提交于 2019-11-27 20:53:38
问题 I created a new Access Key and configured that in the AWS CLI with aws configure . It created the .ini file in ~/.aws/config . When I run aws s3 ls it gives: A client error (InvalidAccessKeyId) occurred when calling the ListBuckets operation: The AWS Access Key Id you provided does not exist in our records. AmazonS3FullAccess policy is also attached to the user. How to fix this? 回答1: It might be happening that you have the old keys exported via env variables (bash_profile) and since the env

Call aws-cli from AWS Lambda

笑着哭i 提交于 2019-11-27 20:25:37
is there ANY way to execute aws-cli inside AWS Lambda? It doesn't seem to be pre-installed. (I've checked with "which aws" via Node.js child-process, and it didn't exist.) Now we can use Layers inside Lambda. Bash layer with aws-cli is available at https://github.com/gkrizek/bash-lambda-layer handler () { set -e # Event Data is sent as the first parameter EVENT_DATA=$1 # This is the Event Data echo $EVENT_DATA # Example of command usage EVENT_JSON=$(echo $EVENT_DATA | jq .) # Example of AWS command that's output will show up in CloudWatch Logs aws s3 ls # This is the return value because it's