Questions tagged [aws-cli]

aws <command> <subcommand> help

Filter by
Sorted by
Tagged with
0 votes
0 answers
38 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-...
user avatar
0 votes
1 answer
163 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' ...
user avatar
  • 101
1 vote
1 answer
54 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 ...
user avatar
  • 111
1 vote
1 answer
245 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 ...
user avatar
0 votes
0 answers
86 views

Set Environment variables or pass parameters to script when using AWS Boto3 send_command

I would like to pass details from my build pipeline down to my powershell script. Is this possible? This is a snippet of what I am trying to do (incomplete so don't worry about how I handle the ...
user avatar
0 votes
1 answer
118 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 ...
user avatar
0 votes
0 answers
220 views

How to store result of a AWS CLI command in Classic Azure DevOps Pipeline

I have a AWS CLI task (create-upload) that when run, returns with a json result that contains an URL. This task works fine. I however need to use the URL from that create-upload task in the next task (...
user avatar
  • 101
1 vote
1 answer
107 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 ...
user avatar
  • 121
2 votes
1 answer
338 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 ...
user avatar
  • 31
1 vote
1 answer
330 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 ...
user avatar
  • 463
0 votes
1 answer
198 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 ...
user avatar
  • 463
1 vote
0 answers
166 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 ...
user avatar
  • 111
1 vote
0 answers
24 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 ...
user avatar
  • 11
1 vote
1 answer
278 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?...
user avatar
  • 121
0 votes
1 answer
237 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 ...
user avatar
  • 463
2 votes
1 answer
234 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 ...
user avatar
2 votes
1 answer
238 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-...
user avatar
1 vote
2 answers
494 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 ...
user avatar
5 votes
1 answer
3k 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 ...
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 ...
user avatar
0 votes
2 answers
588 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 ?
user avatar
4 votes
1 answer
1k 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 ...
user avatar
  • 141
0 votes
1 answer
42 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 ...
user avatar
1 vote
1 answer
343 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 ...
user avatar
1 vote
1 answer
235 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 ....
user avatar
2 votes
2 answers
553 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?
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 ...
user avatar
  • 7,011
4 votes
4 answers
2k 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 ...
user avatar
  • 277
3 votes
2 answers
72 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 ...
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 ...
user avatar
  • 277
3 votes
1 answer
398 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
62 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-...
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 ...
user avatar
  • 343
6 votes
2 answers
2k 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\...
user avatar
  • 7,011
0 votes
1 answer
324 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 ...
user avatar
  • 7,011
3 votes
1 answer
6k 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 ...
user avatar
  • 7,011
5 votes
2 answers
6k 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 "...
user avatar
  • 7,011
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 ...
user avatar
  • 7,011
5 votes
4 answers
8k 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 --...
user avatar
  • 7,011
16 votes
5 answers
36k 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 ...
user avatar
  • 7,011
-1 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: ...
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 ...
user avatar
17 votes
4 answers
32k 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 ...
user avatar
3 votes
1 answer
31 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 ...
user avatar
  • 1,073
5 votes
4 answers
2k views

How can I get a list of encrypted disks for instances that are running on the AWS CLI?

There is a great question here about how to get a list of encrypted disks. I'm currently using the describe-volumes command. For the record I'm currently using: aws ec2 describe-volumes --region us-...
user avatar
  • 1,073
5 votes
1 answer
12k views

How to get environment variables in ECS container?

What AWS CLI command should I be using to access the environment variables in an AWS ECS cluster's task's container? I've seen describe-cluster, list-tasks, describe-tasks, describe-container-...
user avatar
  • 4,102
11 votes
1 answer
970 views

How to set up AWS Trusted Advisor alert for Service Limit warnings?

All I want in life is for AWS to shoot me an email when any of Trusted Advisor's Service Limits go to WARN or ERROR status. I've checked their guides, tried chatting with support and no one can get ...
user avatar
  • 4,102