Questions tagged [aws-cli]

The AWS Command Line Interface (CLI) is a unified tool to manage AWS services.

The AWS Command Line Interface (CLI) is a unified tool to manage AWS services. Multiple AWS services can be controlled via the command line and various actions can be automated through this tool.

Questions involving an alternate implementation for Windows PowerShell, AWS Tools for PowerShell, should be tagged with instead.

Resources

3275 questions
48
votes
6 answers

Call aws-cli from AWS Lambda

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.)
48
votes
4 answers

How do I set the name of the default profile in AWS CLI?

When I give the command aws config list, I get the following output for the default profile: Name Value Type Location ---- ----- ---- -------- profile …
TheRookierLearner
  • 2,863
  • 8
  • 31
  • 50
48
votes
1 answer

Difference between s3cmd, boto and AWS CLI

I am thinking about redeploying my static website to Amazon S3. I need to automate the deployment so I was looking for an API for such tasks. I'm a bit confused over the different options. Question: What is the difference between s3cmd, the Python…
user1781186
48
votes
5 answers

List public IP addresses of EC2 instances

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…
Bas Peeters
  • 3,085
  • 4
  • 30
  • 47
47
votes
6 answers

How to temporarily switch profiles for AWS CLI?

Edit: Here's the solution that worked for me: export AWS_DEFAULT_PROFILE=user2 The full question is below for context: (1.) After successfully configuring a second profile for the AWS CLI, I unsuccessfully tried to set the profile to user2 in my…
James Shapiro
  • 2,796
  • 1
  • 22
  • 26
47
votes
5 answers

how to return items in a dynamodb on aws-cli

So, I have a DynamoDB table Users and I want to return all the contents of this table. Or maybe even some. I tried aws dynamodb query --table-name Users and it says I have to specify key-condition or key-condition-expression, so I added the…
Bennjoe Mordeno
  • 2,041
  • 1
  • 8
  • 18
46
votes
5 answers

Can I force CloudFormation to delete non-empty S3 Bucket?

Is there any way to force CloudFormation to delete a non-empty S3 Bucket?
Jamie Czuy
  • 1,053
  • 1
  • 9
  • 16
45
votes
10 answers

Can't Delete Empty S3 Bucket

I have an S3 bucket that is 100% empty. Versioning was never enabled on the bucket. However, I still cannot remove the bucket. I have tried via the Console and the CLI tool. On the console it just says "Error" with no error message. From the…
Tim Martin
  • 1,800
  • 1
  • 15
  • 25
44
votes
3 answers

AWS S3 sync --delete, removed new files in local

aws s3 sync --delete removed some new files. For example: There is a file in the bucket - S3://my-bucket/images/1.jpg Then, I uploaded a file to the server: 2.jpg There are 2 files in the server: 1.jpg and 2.jpg Start running the sync cronjob: aws…
Keith Kong
  • 541
  • 1
  • 4
  • 3
42
votes
8 answers

How to uninstall aws-cli

I am trying to set up an "Amazon Elastic Container Registry" but I get the following error when using this command: aws ecr get-login --no-include-email --region us-west-2: Unknown options: --no-include-email The manual redirects me when this occurs…
user007
  • 1,340
  • 2
  • 13
  • 22
40
votes
5 answers

Is there any way to get s3 uri from aws web console?

I want to download a directory from my s3. When I need a file, the s3 management console (aws web console) allows me to download it, but when a directory, I have to use aws-cli, like: $ aws s3 cp s3://mybucket/mydirectory/ . --recursive My question…
keisuke
  • 1,703
  • 4
  • 16
  • 28
40
votes
3 answers

User is not authorized to perform: dynamodb:PutItem on resource

I am trying to access DynamoDB from my Node app deployed on AWS ElasticBeanStalk. I am getting an error User is not authorized to perform: dynamodb:PutItem on resource It works perfectly fine locally, but when I deploy to the AWS it stops…
37
votes
6 answers

Copy multiple files from s3 bucket

I am having trouble downloading multiple files from AWS S3 buckets to my local machine. I have all the filenames that I want to download and I do not want others. How can I do that ? Is there any kind of loop in aws-cli I can do some iteration…
DQI
  • 485
  • 1
  • 4
  • 7
36
votes
9 answers

Using aws cli, what is best way to determine the current region

Interactively, I can use "aws configure" to change or see the default region. Is there a "pwd" like function, documented or not that allows me to determine or confirm the current region mid-script ? Even if AWS_DEFAULT_REGION is not defined ? I want…
mckenzm
  • 1,001
  • 1
  • 8
  • 15
36
votes
6 answers

How to cp file only if it does not exist, throw error otherwise?

aws s3 cp "dist/myfile" "s3://my-bucket/production/myfile" It always copies myfile to s3 - I would like to copy file ONLY if it does no exist, throw error otherwise. How I can do it? Or at least how I can use awscli to check if file exists?
user606521
  • 11,796
  • 18
  • 90
  • 180