As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [aws-cli]

aws <command> <subcommand> help

Filter by
Sorted by
Tagged with
0 votes
0 answers
19 views

EFS is getting demounted from lambda when there is an update to efs

I have created efs, and mounted this on lambda using terraform. It works good, but when there is an update in efs , the efs is getting demounted. I need a terraform script to detect this update and ...
Vinay Chiruvella's user avatar
0 votes
0 answers
17 views

Cannot set policy to a role in aws

I'm trying to set a policy that I configured to a role that I made in aws. The policy and role called test-policy and test-role were created from the aws-console. In the console I added the policy to ...
ptushev's user avatar
0 votes
0 answers
78 views

Terraform - No Infrastructure Changes Detected

I have deployed a Cloudwatch Log Group community module to my terraform stack (sourced from https://github.com/cloudposse/terraform-aws-components) but I have spent more than a day trying to resolve ...
Don Draper's user avatar
0 votes
1 answer
397 views

calculating the size of objects in AWS S3 buckets

I ran into an problem recently, my AWS S3 bucket shows total size of 30 TB. However when i try to get the total size of individual folders, it is not summing up more than 2 TB. I used the below ...
Saran's user avatar
  • 3
1 vote
0 answers
32 views

aws cli shorthand json syntax

I'm trying to update the domain contacts for a couple of 100 domains using AWS cli with the shorthand syntax. This works fine for .com domains: aws route53domains update-domain-contact --domain-...
Sean C's user avatar
  • 11
0 votes
0 answers
68 views

How do I find or set my working directory in AWS CLI for windows?

I'm using windows 11 and new to AWS CLI. I downloaded some open data through the AWS CLI on windows and I don't know where the files were downloaded to. How do I determine where my working directory ...
richardgasquet's user avatar
0 votes
1 answer
254 views

Filtering AWS SQS Tags using JQ

I'm having doubts when trying to run a query with JQ. I have an SQS queue with Tags applied and when I run aws sqs list-queue-tags --region sa-east-1 --queue-url <my-url-queue> --output json | ...
Weyder Ferreira's user avatar
0 votes
0 answers
19 views

DynamoDB restore not restoring to the running instance

Working on the fully automated PoC that builds lambda app on AWS connected to dynamoDb from Azure Devops platform. Worked good until the point i had to use backup and restore of the dynamoDb. Backup ...
Milan Ples's user avatar
0 votes
0 answers
341 views

How to list all user policies, groups and associated permissions and extract to CSV?

This sample only shows users directly related to policies - no groups are shown: for u_name in $(aws iam list-users | jq -r '.Users[].UserName') ; do permissions="$(aws iam list-attached-user-...
Engineer1's user avatar
1 vote
1 answer
751 views

How to fix wrong /etc/resolv.conf in kubernetes pods after creating a cluster with EKS eksctl with vpc-cni plugin?

So, i've created a kubernetes cluster in EKS with eksctl, ClusterConfig: apiVersion: eksctl.io/v1alpha5 kind: ClusterConfig metadata: name: exchange-develop region: us-east-1 version: '1.19' ...
paltaa's user avatar
  • 121
3 votes
2 answers
390 views

AWS CLI and a JSON file

I'm setting up my AWS CLI. To access to AWS services like EC2, I have to switch roles. I used the command aws sts assume-role, and it spit out JSON with Credentials and AssumedRoleUser, complete with ...
ahoffer's user avatar
  • 43
2 votes
1 answer
2k views

View billing and cost management dashboard info with AWS CLI

The aws web console under "Billing" (https://console.aws.amazon.com/billing/) shows "Month-to-Date Spend by Service" which breaks down costs incurred so far this month by each ...
webninja's user avatar
0 votes
1 answer
430 views

AWS FARGATE ECS - Exact steps to deploy new Docker images with aws CLI

We run services in AWS FARGATE... our Docker builds are tagged before we push them to AWS with a Makefile. I committed changes to a Docker service, ran make, and I see the new Docker image tag when I ...
Mike Pennington's user avatar
1 vote
1 answer
169 views

Deploy to Ubuntu server with python script and awsebcli fails

Just yesterday everything worked fine on our AWS ElasticBeanstalk continuous deployment, but today suddenly fails with the following errors: $ pip install awsebcli -q --upgrade DEPRECATION: Python 2.7 ...
boldnik's user avatar
  • 121
2 votes
1 answer
910 views

AWS SNS-SQS: Checking a subscription already exists

I've found it's a useful strategy to create relevant queues whenever a queue worker service boots. For instance, on service boot, it checks whether its queues exist already in AWS and creates them if ...
Trout's user avatar
  • 31
1 vote
1 answer
559 views

In the AWS CLI how do I treat a special character as a string?

I'm trying to run an AWS CLI command for a resource with a ! in its name. I'm doing this from Centos docker instance running on my local device a MAC and if I run echo "$SHELL" it says it ...
doug's user avatar
  • 493
0 votes
1 answer
308 views

How do I edit my AWS ASG scheduled action useing the aws CLI

my scheduled action is called training my ASG is called temp_4_jenkins as I was planning to set up a pipeline on a Jenkins on my personal account to run the CLI commands. aws application-autoscaling ...
doug's user avatar
  • 493
1 vote
0 answers
294 views

Can Gitlab Auto DevOps provide an aws/dynamodb-local service without being customised?

I'm using an aws/dynamodb-local Docker container for use during local testing of my Node application and I'd like to integrate it with my Gitlab CI test job. I have made a rudimentary extension to ...
Phil D.'s user avatar
  • 111
1 vote
0 answers
34 views

Allow specific AWS permissions(Lambda, S3) / roles to specific Jenkins Jobs within same AWS account

We have one AWS account in which an Ec2 instance is running where Jenkins is installed, and we have attached an IAM role to it, with s3 access permission. We have Jenkins jobs which needed aws ...
susil95's user avatar
  • 111
1 vote
1 answer
596 views

`UnauthorizedResourceAccessException` when calling `aws workdocs create-user`

When calling aws workdocs create-user, I'm getting UnauthorizedResourceAccessException or UnauthorizedOperationException. I believe I have all of the permissions required. What could be causing this?...
claytond's user avatar
  • 121
0 votes
1 answer
312 views

Was AWS Secrets Manager removed from AWS CLI commands?

If I enter: aws secretsmanager get-secret-value --secret-id my secret id It says invalid choice. aws: error: argument command: Invalid choice, valid choices are: and doesn't list ...
doug's user avatar
  • 493
2 votes
1 answer
400 views

Cross Account EC2 Access from within Amazon Workspace

I have a requirement to setup a bastion host (Amazon Workspace) to connect to an ec2 instance living on a different account. As Amazon Workspaces cannot assume a role the way EC2s can, A cross ...
Inderpal Singh's user avatar
3 votes
1 answer
476 views

Get tagging to work on AWS CLI

I am trying to tag commit hash and app version onto the ECS service to make it easier for developers to identify the service with the code. But I get this error + aws ecs tag-resource --resource-...
Moses Liao GZ's user avatar
1 vote
2 answers
1k views

Is there a policy that can limit the growth of an AWS S3 buckets total size?

We have an AWS S3 bucket that accepts uploads from untrusted sources which are then processed and moved out of the bucket. Is there a Policy that can limit the growth of the bucket to some ...
David Parks's user avatar
7 votes
1 answer
6k views

Running a command as a specific user on an ec2 using ssm

Background I want to automatically configure an EC2 via a build, using the aws cli and ssm. The (manual) setup for the container looks something like this: Create an EC2 Run a shell script as root ...
Max Colledge's user avatar
1 vote
1 answer
27 views

Kubernetes api service unit file

i was going through the kubernetes the hard way(kelsey), i see in the API server unit file with a cluster ip range as --service-cluster-ip-range=10.32.0.0/24 \ is it a default ip range ? my VPC ...
Jithin Kumar S's user avatar
0 votes
2 answers
1k views

AWS-CLI : to download IAM user with policy

aws : A single command(aws-cli) to get the IAM user name with the what all permission he/she have , would be great if can be downloaded as an excel or csv ?
Jithin Kumar S's user avatar
4 votes
1 answer
2k views

How to install aws cli on a self-hosted azure DevOps Windows agent?

I have quite some difficulties installing aws cli on a self-hosted Azure DevOps Windows agent as part of a pipeline. Does anyone have a working solution? What I have tried so far: a) install aws cli ...
hey's user avatar
  • 141
0 votes
1 answer
51 views

How to probe all running aws ec2 instances and their sec groups, etc to generate templates?

Typically I spin up all aws ec2 instances together with all its accompanying security groups, volumes, etc ... by executing a series of aws cli commands. However when I manually use the aws console ...
Scott Stensland's user avatar
1 vote
1 answer
483 views

How can I 'aws s3 sync' two buckets, which are located in different accounts

I'm trying to use 'aws s3 sync' on the awscli between two accounts. Account A, I own. Account B, Owned by a third party. Account B has given a user:jon on account A permission to a bucket through ...
phisshion's user avatar
1 vote
1 answer
340 views

How to override default aws region credentials for Terraform?

I am using Terraform to create aws resources. I practiced with a single region and with my aws cli credentials being used. worked great! however when I tried to override the region in the Terraform ....
Alan-Cugler's user avatar
2 votes
2 answers
1k views

Cross account access from ec2 to other accounts

Is it possible to run aws cli from ec2 to create some resources in another account without using aws_secret_key and aws_access_key?
Pzowghi's user avatar
  • 23
3 votes
0 answers
2k views

How to override the user for ECS task via CLI? [closed]

I've got a Task Definition with parameters which executes a script using a regular user. I'd like to test the script without changing the Task Definition by overriding the default user which script ...
kenorb's user avatar
  • 7,621
4 votes
4 answers
3k views

How to see when an AWS IAM role was last used?

In AWS in the GUI you can select a role and then click on delete, then when you are prompted to approve or deny the deletion it shows you when the role was last used. I would like to be able to know ...
Uberhumus's user avatar
  • 277
3 votes
2 answers
84 views

AWS CLI --profile with duration > 1h

With the AWS CLI you can assume a role using the --profile parameter: aws --profile <profile_name> <service> <command> e.g.: aws --profile admin s3 ls s3://mybucket/ That profile ...
Hubert Grzeskowiak's user avatar
1 vote
1 answer
2k views

Different download speeds from AWS S3 CLI vs Console/Websites

I'm experiencing much slower traffic for the exact same files when downloading (or uploading) them via the AWS website vs. downloading them via the CLI. Is there a known reason for this? Is there ...
Uberhumus's user avatar
  • 277
3 votes
1 answer
455 views

Configure AWS cli inside chef cookbook

I am working on setting up something with S3 and Chef, I have AWS CLI installed and working but I need to figure out how to specify the access ID and the secret access key. I know there are cookbooks ...
user avatar
1 vote
1 answer
91 views

AWS Security Group Creation Using AWS CLI

I have created a security group in AWS. I have added the ingress rule using the below command aws ec2 authorize-security-group-ingress --group-id sg-07xxxx4d --ip-protocol tcp --from-port 22 --to-...
Prashast's user avatar
4 votes
3 answers
2k views

Amazon EKS from local kubectl does not cache MFA token/session

I have set up an EKS cluster in AWS. My user-account there is secured with MFA. And I have an assumerole, that is allowed to manage my infrastructure. So I installed and configured my system as ...
Max N.'s user avatar
  • 383
6 votes
2 answers
3k views

How to find out the used Key pair name via AWS CLI?

I'm aware of get-password-data command which can display PasswordData data like: $ aws ec2 get-password-data --instance-id i-0123456789 { "InstanceId": "i-0123456789", "PasswordData": "\r\...
kenorb's user avatar
  • 7,621
0 votes
1 answer
345 views

How to access ephemeral storage of EC2 instance?

I've got ephemeral storage setup in Scalr as part of the role. The instance is spinned up by Chef and it seems it is running fine (it's using ephemeral0 device mounted as D: drive). I've tried to use ...
kenorb's user avatar
  • 7,621
3 votes
1 answer
7k views

How to export EC2 snapshot into S3 bucket?

I've created a snapshot of EC2 instance via: aws ec2 create-snapshot --volume-id vol-xyz In aws ec2 create-snapshot help we can read: Creates a snapshot of an EBS volume and stores it in Amazon ...
kenorb's user avatar
  • 7,621
5 votes
2 answers
8k views

How to avoid output being truncated when running AWS SSM command?

I've got the following AWS CLI commands to run the PowerShell's Invoke-WebRequest command: instanceId=i-0xyz # Change this. cmdId=$(aws ssm send-command --instance-ids "$instanceId" --document-name "...
kenorb's user avatar
  • 7,621
0 votes
2 answers
2k views

How to get instance's route table id using CLI?

I'd like to find a route table id associated with the given EC2 instance. How can this be achieved using AWS CLI? I've tried to use aws ec2 describe-vpcs, but the route tables are not there. I'm ...
kenorb's user avatar
  • 7,621
6 votes
5 answers
11k views

How to list security groups for the specific instance via CLI?

I'm looking for syntax like: aws ec2 describe-security-groups --instance-id i-0xyz however, the above sub-command doesn't support --instance-id parameter. I've checked and there are --filters and --...
kenorb's user avatar
  • 7,621
16 votes
5 answers
43k views

How to run a script or a command on EC2 instance via AWS CLI?

According to New EC2 Run Command news article, AWS CLI should support a new sub-command to execute scripts on remote EC2 instances. However I've checked in aws ec2 help, but I can't find the relevant ...
kenorb's user avatar
  • 7,621
0 votes
1 answer
2k views

How to send sms to a phone number using aws sns cli? [closed]

I am using the following command. Getting Authorization error. aws sns publish --phone-number +91XXXXXXXXXX --message hello An error occurred (AuthorizationError) when calling the Publish operation: ...
Saikat Kundu Chowdhury's user avatar
3 votes
2 answers
2k views

List encrypted RDS snapshots using CLI

I have automated the RDS snapshot copy across the region, but the Snapshot which is encrypted gets fail to copy. I have figured a way to copy an encrypted snapshot using $ aws rds copy-db-snapshot ...
Nirbhay Singh's user avatar
19 votes
6 answers
36k views

View all AWS S3 buckets and list each buckets storage used

I have multiple AWS accounts and I need to list all S3 buckets per account and then view each buckets total size. Currently, I can only view the storage size of a single S3 bucket with: aws s3 ls ...
Kyle Steenkamp's user avatar
3 votes
1 answer
33 views

What is the ec2 cli command to modify the minimum number of nodes in a scaling group?

I've got an ec2 autoscaling group that starts in the morning and finishes in the evening. I'd like to create a 'button' that people can click to warm up the autoscaling group to run jobs in the middle ...
hawkeye's user avatar
  • 1,103