Questions tagged [aws-cli]
aws <command> <subcommand> help
52
questions
0
votes
0
answers
74
views
Can't see the resources on AWS EKS, after I created a Cluster through CLI
I created a basic EKS Cluster from CLI, it created all the resources and I could view them through my CLI (pods, nodes, nameservers etc.)
However when getting into AWS platform, I could find the ...
0
votes
0
answers
45
views
EFS is getting unmounted from lambda when there is an update to efs
I have created EFS, and mounted this on lambda using terraform. It works, but when there is an update in EFS, then EFS gets unmounted.
I need terraform to detect this update and automatically mount it ...
0
votes
0
answers
25
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 ...
0
votes
0
answers
573
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 ...
0
votes
1
answer
771
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 ...
1
vote
0
answers
50
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-...
0
votes
1
answer
354
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 | ...
0
votes
0
answers
431
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-...
1
vote
1
answer
1k
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'
...
3
votes
2
answers
587
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 ...
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 ...
0
votes
1
answer
509
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 ...
1
vote
1
answer
203
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 ...
2
votes
1
answer
1k
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 ...
1
vote
1
answer
695
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 ...
0
votes
1
answer
344
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 ...
1
vote
0
answers
346
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 ...
1
vote
0
answers
38
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 ...
1
vote
1
answer
763
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?...
0
votes
1
answer
347
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 ...
2
votes
1
answer
461
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 ...
3
votes
1
answer
583
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-...
1
vote
2
answers
2k
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 ...
7
votes
1
answer
8k
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
...
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 ...
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 ?
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 ...
0
votes
1
answer
53
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 ...
1
vote
1
answer
621
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 ...
1
vote
1
answer
467
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 ....
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?
3
votes
0
answers
3k
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 ...
4
votes
4
answers
4k
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 ...
3
votes
2
answers
86
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 ...
1
vote
1
answer
3k
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 ...
3
votes
1
answer
471
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 ...
1
vote
1
answer
97
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-...
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 ...
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\...
0
votes
1
answer
360
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 ...
3
votes
1
answer
8k
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 ...
6
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 "...
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 ...
6
votes
5
answers
12k
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 --...
16
votes
6
answers
46k
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 ...
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: ...
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 ...
21
votes
6
answers
39k
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 ...
3
votes
1
answer
34
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 ...
5
votes
4
answers
3k
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-...