aws-cli

Getting 403 forbidden from s3 when attempting to download a file

筅森魡賤 提交于 2019-11-27 15:38:34
I have a bucket on s3, and a user given full access to that bucket. I can perform an ls command and see the files in the bucket, but downloading them fails with: A client error (403) occurred when calling the HeadObject operation: Forbidden I also attempted this with a user granted full S3 permissions through the IAM console. Same problem. For reference, here is the IAM policy I have: { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "s3:ListAllMyBuckets", "Resource": "arn:aws:s3:::*" }, { "Effect": "Allow", "Action": "s3:*", "Resource": [ "arn:aws:s3:::mybucket", "arn

List public IP addresses of EC2 instances

走远了吗. 提交于 2019-11-27 11:55:09
问题 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? 回答1: Directly from the aws cli: aws ec2 describe-instances \ --query "Reservations[*].Instances[*].PublicIpAddress" \ --output=text 回答2: Filter on running instances (you

Getting Outputs from aws cloudformation describe-stacks

最后都变了- 提交于 2019-11-27 11:29:31
问题 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": [],

AWS ECS Error when running task: No Container Instances were found in your cluster

若如初见. 提交于 2019-11-27 10:59:23
Im trying to deploy a docker container image to AWS using ECS , but the EC2 instance is not being created. I have scoured the internet looking for an explanation as to why I'm receiving the following error: "A client error (InvalidParameterException) occurred when calling the RunTask operation: No Container Instances were found in your cluster." Here are my steps: 1. Pushed a docker image FROM Ubuntu to my Amazon ECS repo. 2. Registered an ECS Task Definition: aws ecs register-task-definition --cli-input-json file://path/to/my-task.json 3. Ran the task: aws ecs run-task --task-definition my

How to test credentials for AWS Command Line Tools

こ雲淡風輕ζ 提交于 2019-11-27 09:26:54
问题 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

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

别来无恙 提交于 2019-11-27 07:42:10
问题 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

How to find OS of an EC2 instance using AWS CLI

£可爱£侵袭症+ 提交于 2019-11-27 03:32:15
问题 How can you find out the OS running on an EC2 instance using AWS CLI. The ec2 describe-instance command spits out a lot of information , but there is nothing indicating the OS . I also tried ec2 describe-images on a specific image. Again, there doesn't seem to be any indication of OS. Help..? 回答1: Here's a quick way to list the Platform field, which at least distinguishes between Windows and Linux: aws ec2 describe-instances --query 'Reservations[*].Instances[*].[InstanceId,Platform]' -

How to upgrade AWS CLI to the latest version?

戏子无情 提交于 2019-11-27 00:25:05
问题 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

How to change User Status FORCE_CHANGE_PASSWORD?

我只是一个虾纸丫 提交于 2019-11-26 23:54:19
问题 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 回答1: 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

Call aws-cli from AWS Lambda

二次信任 提交于 2019-11-26 22:52:45
问题 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.) 回答1: 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