Questions tagged [aws-cli]

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

Filter by
Sorted by
Tagged with
1090 votes
41 answers
871k views

Downloading an entire S3 bucket?

I noticed that there does not seem to be an option to download an entire s3 bucket from the AWS Management Console. Is there an easy way to grab everything in one of my buckets? I was thinking about ...
rugbert's user avatar
  • 12.1k
310 votes
3 answers
207k views

How to test credentials for AWS Command Line Tools

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 of which user the ...
smitelli's user avatar
  • 7,215
238 votes
12 answers
173k views

How to use multiple AWS accounts from the command line?

I've got two different apps that I am hosting (well the second one is about to go up) on Amazon EC2. How can I work with both accounts at the command line (Mac OS X) but keep the EC2 keys & ...
Matt Culbreth's user avatar
225 votes
4 answers
154k views

How can I use wildcards to `cp` a group of files with the AWS CLI? [closed]

I'm having trouble using * in the AWS CLI to select a subset of files from a certain bucket. Adding * to the path like this does not seem to work: aws s3 cp s3://data/2016-08* .
metersk's user avatar
  • 12.1k
224 votes
37 answers
796k views

How can I resolve the error "The security token included in the request is invalid" when running aws iam upload-server-certificate?

I cd into the directory where all the pem/key files are and run the following: aws iam upload-server-certificate --server-certificate-name certificate_name --certificate-body file://...
Killesk's user avatar
  • 2,944
215 votes
14 answers
151k views

How to change User Status FORCE_CHANGE_PASSWORD?

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 ...
Dominique Vial's user avatar
174 votes
19 answers
159k views

How to upgrade AWS CLI to the latest version?

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 ...
Borealis's user avatar
  • 8,264
169 votes
13 answers
132k views

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

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 ...
cosbor11's user avatar
  • 15.4k
160 votes
7 answers
234k views

Error "You must specify a region" when running any aws CLI command

I am trying to use aws container service as per the documentation in http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_GetStarted.html The below error is thrown when running the command: ...
user859375's user avatar
  • 3,619
158 votes
4 answers
78k views

Quick way to get AWS Account number from the AWS CLI tools?

Looking for a quick way to pull my account number, I had originally thought of using aws iam get-account-authorization-details --max-items 1 but there are several issues with doing it this way. Is ...
ehime's user avatar
  • 8,175
155 votes
37 answers
358k views

The AWS Access Key Id does not exist in our records

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) ...
kaushikdr's user avatar
  • 1,849
154 votes
15 answers
263k views

AWS : The config profile (MyName) could not be found

Every time I want to config something with AWS I get the following error : "The config profile (myname) could not be found" like : aws configure I'm using Python 3.4 and I want to use AWS CLI ...
Steve Ritz's user avatar
  • 2,167
142 votes
36 answers
488k views

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

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....
MojoJojo's user avatar
  • 4,047
137 votes
5 answers
84k views

How to use AWS S3 CLI to dump files to stdout in BASH?

I'm starting a bash script which will take a path in S3 (as specified to the ls command) and dump the contents of all of the file objects to stdout. Essentially I'd like to replicate cat /path/to/...
Neil C. Obremski's user avatar
133 votes
28 answers
114k views

How do I delete a versioned bucket in AWS S3 using the CLI?

I have tried both s3cmd: $ s3cmd -r -f -v del s3://my-versioned-bucket/ And the AWS CLI: $ aws s3 rm s3://my-versioned-bucket/ --recursive But both of these commands simply add DELETE markers to ...
NobleUplift's user avatar
  • 5,797
132 votes
11 answers
127k views

AWS ECR GetAuthorizationToken

I've tried to follow AWS instructions on setting ECR authorization to my user by giving the AmazonEC2ContainerRegistryFullAccess policy to my user. However when I try to run on my PC the aws ecr get-...
Y. Eliash's user avatar
  • 1,968
130 votes
17 answers
123k views

AWS CLI $PATH Settings

I am following the AWS CLI Setup guide. I have managed to successfully install the tool on my Mac OS X terminal with the following output: Running cmd: /usr/bin/python virtualenv.py --python /usr/bin/...
fr_muses's user avatar
  • 1,475
117 votes
8 answers
198k views

How Do I Clear The Credentials In AWS Configure?

I have deleted the AWS credentials in sudo nano ~/.aws/config. But, the credentials are still in aws configure. Is there a way to reset aws configure with clear state?
ultraInstinct's user avatar
116 votes
12 answers
218k views

How to display only files from aws s3 ls command?

I am using AWS CLI to list the files in an AWS S3 bucket using the following command (aws s3 ls): aws s3 ls s3://mybucket --recursive --human-readable --summarize This command gives me the following ...
Borealis's user avatar
  • 8,264
115 votes
9 answers
142k views

How to temporarily switch profiles for AWS CLI?

Updated answer (7/10/2021): For AWS CLI v1, do this: export AWS_DEFAULT_PROFILE=user2 For AWS CLI v2, the following will work: export AWS_PROFILE=user2 The full question is below for context: (1.) ...
James Shapiro's user avatar
115 votes
10 answers
210k views

How list Amazon S3 bucket contents by modified date?

Most of the time it happens that we load files in a common S3 bucket due to which it becomes hard to figure out data in it. How can I view objects uploaded on a particular date?
azhar22k's user avatar
  • 5,015
114 votes
10 answers
92k views

AWS sts assume role in one command

To assume an AWS role in the CLI, I do the following command: aws sts assume-role --role-arn arn:aws:iam::123456789123:role/myAwesomeRole --role-session-name test --region eu-central-1 This gives to ...
Arcones's user avatar
  • 4,292
112 votes
15 answers
98k views

how to view aws log real time (like tail -f)

I can view the log using the following command. aws logs get-log-events --log-group-name groupName --log-stream-name streamName --limit 100 what is the command to get feature like tail -f so that i ...
LynAs's user avatar
  • 6,497
111 votes
6 answers
157k views

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 ---- ----- ...
TheRookierLearner's user avatar
106 votes
1 answer
19k views

How do you comment out lines in AWS CLI config and credentials files?

For AWS CLI configuration and credentials files how do you comment out lines in these files - I checked the documentation here http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started....
kellyfj's user avatar
  • 6,725
105 votes
17 answers
37k views

Unable to select Custom SSL Certificate (stored in AWS IAM)

I am going to create a new distribution at CloudFront. Already I have uploaded my SSL certificate at AWS IAM using AWS CLI. That certificate appears in the Custom SSL Certificate dropdown on new ...
theGeekster's user avatar
  • 6,161
103 votes
16 answers
144k views

How to install aws-cli on alpine?

I'm installing aws-cli on a docker swarm manager node running alpine (Linux 0317632a4ad9 4.9.59-moby #1 SMP Thu Mar 1 20:54:00 UTC 2018 x86_64 Linux). The aws-cli package for Alpine is currently ...
HieroB's user avatar
  • 4,087
101 votes
6 answers
36k views

How to turn off the pager for AWS CLI return value?

I am attempting to utilize the AWS CLI along with a for loop in bash to iteratively purge multiple SQS message queues. The bash script works almost as intended, the problem I am having is with the ...
Colin Armstrong's user avatar
99 votes
11 answers
161k views

passing access and secret key aws cli

I am trying to embed access and secret key along with aws cli. e.g. aws ec2 describe-instances --aws-access-key <access_key> --aws-secret-key <secret_key> Also tried with -o and -w ...
user3089927's user avatar
  • 3,745
92 votes
5 answers
56k views

Getting Outputs from aws cloudformation describe-stacks

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": [ ...
Steven Yong's user avatar
  • 5,364
91 votes
11 answers
113k views

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 ? ...
mckenzm's user avatar
  • 1,700
89 votes
3 answers
82k views

Get ARN of S3 Bucket with aws cli

Is it possible to get the ARN of an S3 bucket via the AWS command line? I have looked through the documentation for aws s3api ... and aws s3 ... and have not found a way to do this.
ljcundiff's user avatar
  • 1,179
88 votes
31 answers
108k views

`Authorization Token has expired` issue AWS-CLI on MacOS Sierra

I'm trying to push a docker image to the AWS ECR repository using the aws-cli. I just run the get-login command execute the output (which returns login succeeded) then try to push a docker image ...
Ludo - Off the record's user avatar
85 votes
26 answers
292k views

SSL CERTIFICATE_VERIFY_FAILED in aws cli

I installed AWS CLI on the Windows server 2007 32bit. aws --version aws-cli/1.8.8 Python/2.7.9 Windows/2008Server I configure aws cli using keys Once I run below command to test AWS S3, I get this ...
DD Dev's user avatar
  • 999
79 votes
8 answers
55k views

awscli version 2 on alpine linux

I was trying to put awscli_v2 into an alpine-based docker container and see that it fails with the following error message: /aws/install: line 78: /aws/dist/aws: not found Considering that the ...
Konstl's user avatar
  • 823
79 votes
2 answers
90k views

AWS create role - Has prohibited field

I am trying out a simple example suggested by AWS documentation to create a role using a policy json file http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-service.html And I get the ...
Chenna V's user avatar
  • 10.3k
77 votes
24 answers
139k views

CircleCI message "error: exec plugin: invalid apiVersion "client.authentication.k8s.io/v1alpha1"

I am facing an error while deploying deployment in CircleCI. Please find the configuration file below. When running the kubectl CLI, we got an error between kubectl and the EKS tool of the aws-cli. ...
yass's user avatar
  • 889
73 votes
3 answers
73k views

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: ...
Keith Kong's user avatar
72 votes
5 answers
88k views

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-...
beejm's user avatar
  • 2,411
72 votes
21 answers
108k views

awscli fails to work: No module named 'awscli'

I am trying to install awscli using pip3 on Linux Mint 17.2 Rafaela. I am getting the error: Traceback (most recent call last): File "/home/jonathan/.local/bin/aws", line 19, in <module> ...
ThriceGood's user avatar
  • 1,683
71 votes
14 answers
96k views

Parsing secrets from AWS secrets manager using AWS cli

I am retrieving secrets I have stored in AWS secrets manager with the AWS cli like this: aws secretsmanager get-secret-value --secret-id secrets Which returns arn:aws:secretsmanager<ID>:...
Moddaman's user avatar
  • 2,618
70 votes
10 answers
41k views

I cannot install aws cli on mac os with pip - awscli: command not found

I tried to follow this tutorial. This is what I did in the console: pip3 install --user --upgrade awscli after that, when I write: pip3 --version I'm getting: pip 9.0.1 from /Users/user/...
user3766930's user avatar
  • 5,749
70 votes
11 answers
121k views

How to delete multiple files in S3 bucket with AWS CLI

Suppose I have an S3 bucket named x.y.z In this bucket, I have hundreds of files. But I only want to delete 2 files named purple.gif and worksheet.xlsx Can I do this from the AWS command line tool ...
Saqib Ali's user avatar
  • 12.5k
67 votes
8 answers
48k views

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's user avatar
  • 1,373
64 votes
12 answers
210k views

Bash with AWS CLI - unable to locate credentials

I have a shell script which is supposed to download some files from S3 and mount an ebs drive. However, I always end up with "Unable to locate credentials". I have specified my credentials with the ...
Smajl's user avatar
  • 7,743
63 votes
4 answers
74k views

AWS CLI S3: copying file locally using the terminal : fatal error: An error occurred (404) when calling the HeadObject operation

I'm trying to copy files locally from s3 bucket. I can get the list of files on my bucket: aws s3 ls s3://myBucket/myDirectory/todaysFiles/ But when I try to copy the files locally: aws s3 cp s3://...
user2924482's user avatar
  • 8,900
62 votes
8 answers
120k views

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 ...
DQI's user avatar
  • 745
61 votes
8 answers
45k views

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.)
Hirofumi Okino's user avatar
59 votes
6 answers
20k views

aws cli output automatically being sent to vi

I am learning the AWS CLI (v2) and have installed it on Ubuntu 18.04. I am running zsh with oh-my-zsh installed. I am trying to get aws command output to be reported back to the terminal as a JSON ...
moulder's user avatar
  • 2,057
56 votes
5 answers
82k views

AWS EC2 'You are not authorized to perform this operation. Encoded authorization failure message:'

I am attempting to create an EC2 instance and get the following error message. How do I decode it ? Launch Failed You are not authorized to perform this operation. Encoded authorization failure ...
jlo-gmail's user avatar
  • 4,788

1
2 3 4 5
90