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

4345 questions
32
votes
2 answers

Filter S3 list-objects results to find a key matching a pattern

I would like to use the AWS CLI to query the contents of a bucket and see if a particular file exists, but the bucket contains thousands of files. How can I filter the results to only show key names that match a pattern? For example: aws s3api…
dnlbrky
  • 9,396
  • 2
  • 51
  • 64
32
votes
6 answers

How to use awscli inside python script?

I'm using aws ec2 service with awscli. Now I want to put all the commands I type in the console into a python script. I see that if I write import awscli inside a python script it works fine but I don't understand how to use it inside the script.…
e271p314
  • 3,841
  • 7
  • 36
  • 61
31
votes
6 answers

AWS CLI - All commands return Unknown output type: [None]

All of my aws-cli commands returned Unknown output type: [None] I checked my configuration $ aws configure appeared normal but i was unable to edit my 'Default output format' I ran my aws-cli command with --debug and saw MainThread -…
i0x539
  • 4,763
  • 2
  • 20
  • 28
31
votes
2 answers

How can I find the arn of an api gateway stage?

I am trying to use awscli to add tags to my api gateway stage https://docs.aws.amazon.com/cli/latest/reference/apigateway/tag-resource.html I am required to supply the --resource-arn for the stage, however I am unable to ascertain this value. I have…
user3559247
  • 1,117
  • 1
  • 11
  • 21
30
votes
13 answers

delete all log streams of a log group using aws cli

In order to delete a log stream from a log group using the CLI command , individual log stream names are required . Is there a way to delete all log streams belonging to a log group using a single command?
akhila
  • 720
  • 2
  • 7
  • 17
30
votes
2 answers

Invalid type for AWS DynamoDB put-item via CLI (unicode v. dict)

I would like to add an item to my DynamoDB table via command line, but I've run into a type error. The data that I'm trying to add is very simple: { "id": "1" } The command I'm running is equally simple: aws dynamodb put-item --table-name…
samcorcos
  • 2,330
  • 4
  • 27
  • 40
30
votes
4 answers

AWS S3 CLI CP file and add metadata

Trying to copy a local file named test.txt to my s3 bucket and add metadata to the file. But it always prints error: argument --metadata-directive: Invalid choice, valid choices are: COPY | REPLACE Is it possible to do this with the cp command, as I…
Jonathan Andersson
  • 1,342
  • 3
  • 16
  • 31
30
votes
6 answers

How to simplify aws DynamoDB query JSON output from the command line?

I'm working with The AWS Command Line Interface for DynamoDB. When we query an item, we get a very detailed JSON output. You get something like this (it has been built from the get-item in order to be almost exhaustive (the NULL type has been…
herve
  • 3,825
  • 2
  • 18
  • 27
29
votes
5 answers

How to copy multiple file from local to s3?

I am trying to upload multiple files from my local to an AWS S3 bucket, I am able to use aws s3 cp to copy files one by one, But I need to upload multiple but not all ie. selective files to the same S3 folder, Is it possible to do this in a single…
Dev1ce
  • 5,390
  • 17
  • 90
  • 150
29
votes
3 answers

Terraform, getting output from null_resource, local-exec and the AWS CLI

I'm using Terraform to automate provision of Cognito Identity Pools in AWS. The AWS provider doesn't support Cognito yet so I've been using null_resource and local-exec to call the AWS CLI. I have the following resource: resource "null_resource"…
big_tommy_7bb
  • 1,257
  • 2
  • 21
  • 37
28
votes
5 answers

howto abort all incomplete multipart uploads for a bucket

Sometimes multipart uploads hang or don't complete for some reason. In that case you are stuck with orphaned parts that are tricky to remove. You can list them with: aws s3api list-multipart-uploads --bucket $BUCKETNAME I am looking for way to…
Refael Ackermann
  • 1,498
  • 1
  • 18
  • 24
28
votes
4 answers

AWS SQS not receiving SNS messages

I created a SNS topic that publishes all the information coming out of Cloudformation via the cli. However, when I check the queue, it is not receiving any of the SNS messages. I verified the SNS is working by subscribing my email to it, so the…
asdf
  • 2,927
  • 2
  • 21
  • 42
28
votes
3 answers

Log in to AWS using Access Key ID and Secret Access Key ID

In AWS, how do I use my Access Key ID and Secret Access Key? I can't use them in IAM users sign-in link.
richersoon
  • 4,682
  • 13
  • 44
  • 74
28
votes
3 answers

Listing instance name among other data with aws-cli 1.3.6

Using aws-cli 1.3.6 I am trying to get a simple table of my ec2 instances with the Name and state. I have been looking at the --query and JMESpath documentation and I have been able to select the "Value" item of a Map which "Key" item is equal to…
c-garcia
  • 598
  • 1
  • 9
  • 17
27
votes
2 answers

How to use AWS CLI to only copy files in S3 bucket that match a given string pattern

I'm using the AWS CLI to copy files from an S3 bucket to my R machine using a command like below: system( "aws s3 cp s3://my_bucket_location/ ~/my_r_location/ --recursive --exclude '*' --include '*trans*' --region us-east-1" ) This works…
Sam Gilbert
  • 1,642
  • 3
  • 21
  • 38