Questions tagged [aws-cli]
aws-cli is the Amazon Web Services Command Line Interface
391 questions
0 votes
0 answers
135 views
Alternative to AWS Copilot CLI
I am currently using the AWS Copilot CLI to deploy my Docker based API to AWS using ECS, Load Balanced. The CLI is an easy way of deploying an app to AWS. All based on a simple YML definition. As the ...
1 vote
1 answer
44 views
AWS Instance Connect fails, returns only 'VpcId'
I'm trying to setup EC2 Instance Connect to RDP to a Windows server. I'm running the command like so... aws ec2-instance-connect open-tunnel \ --instance-id <my-instance-id> \ --remote-...
0 votes
0 answers
59 views
How to Retrieve lost ppk file in AWS
We hosted our WordPress site on AWS. The website is working fine. But we lost the ppk file to connect to SSH. Is there any way to retrieve the lost ppk file in AWS?
0 votes
1 answer
99 views
Script to check if AWS EBS is optimizing after change
I deal with asymmetric clusters of EC2 nodes. There are certain operations which can only be safely carried out when none of the EBS volumes in the cluster are in an "optimizing" state (e.g. ...
0 votes
1 answer
107 views
unable to get AWS session via AWSPowerShell in Milano Region via STS
I am using some AWSPowerShell script to get reports from my instances. I have old working instances in Tokio region ap-northeast-1, new instances were deployed in Milano region eu-south-1, To get ...
0 votes
1 answer
493 views
Yum update package awscli requries python3
I have an EC2 instance with Rocky Linux 9 (Official) - x86_64 and Cpanel installed. I'm receiving notifications daily about this issue when the system tries to update packages or when I run /scripts/...
1 vote
1 answer
246 views
How can I list the files that are in one S3 bucket but not in the other bucket?
I have two AWS S3 buckets that have mostly the same content but with a few differences. How can I list the files that are in one bucket but not in the other bucket?
1 vote
1 answer
221 views
How can I use the AWS CLI to match the number of objects mentioned in the AWS web UI in my S3 bucket?
I have an AWS S3 bucket s3://mybucket/. Bucket versioning is enabled (screenshot). The AWS console web UI indicates that the S3 bucket has 355,524 objects: How can I use the AWS CLI to match the ...
1 vote
1 answer
364 views
How I can use the AWS CLI to see whether an S3 bucket has versioning activated?
How I can use the AWS CLI (aws s3) to see whether an S3 bucket has versioning activated?
0 votes
1 answer
445 views
Why does `aws s3 ls s3://mybucket/ --recursive | wc -l` list fewer files than the number of objects mentioned in the AWS web UI in my S3 bucket?
I have an AWS S3 bucket s3://mybucket/. Running the following command to count all files: aws s3 ls s3://mybucket/ --recursive | wc -l outputs: 279847 Meanwhile, the AWS console web UI clearly ...
3 votes
3 answers
3k views
How can one copy an S3 bucket as faithfully as possible (e.g., copying all permission settings)?
I want to copy an S3 bucket as faithfully as possible (e.g., copying all permission settings). The standard: aws s3 sync s3://old-bucket s3://new-bucket --source-region us-west-1 --region us-west-2 ...
1 vote
1 answer
170 views
AWS CLI Return Nested Results
I am trying to execute an AWS CLI query for EC2. I have crafted the query below, but the triple nesting seems to be throwing things off for InstanceStatus.Details.Status. aws ec2 describe-instance-...
1 vote
1 answer
246 views
Unable to log into newly restored AWS RDS instance
I have a script that creates a new instance from a snapshot, adding it to my security group, setting the master password and setting it to be publicly available At each stage of the process I use: aws ...
0 votes
0 answers
11k views
No VM guests are running outdated hypervisor (qemu) binaries on this host
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" unzip awscliv2.zip i have used above command to transfer the awslive.zip file for installation of ...
0 votes
1 answer
1k views
Get AWS role name from EC2 instance list using CLI
AWS CLI requests "ec2 describe-instances" and "ec2 describe-iam-instance-profile-associations" include instance profile in the "IamInstanceProfile" property. This ...
1 vote
2 answers
3k views
What does `aws configure` actually do?
It's important to understand from a security standpoint what aws configure actually does behind the scenes. Having read the docs, I'm still not clear on this. We have chosen to move the credentials ...
0 votes
1 answer
518 views
Restrict AWS SSM access to SSH only
I need to restrict some users AWS SSM access to SSH only. These users should only be able to start a SSH session via SSM like this: ProxyCommand sh -c "aws ssm start-session --target %h --...
0 votes
0 answers
994 views
AWS ECR Login error
AWS ECR Login error: command: aws ecr get-login-password --region ap-south-1 | docker login --username AWS --password-stdin {id}.dkr.ecr.{region}.amazonaws.com An error occurred (...
-2 votes
1 answer
275 views
about setting up your local AWS development environment
new to AWS here. Wanted to set up my new Project on the cloud and donate some money to Jeff. How would you set up your local environment today when starting a cloud project? I have issues seeing the ...
0 votes
1 answer
3k views
How to connect to AWS EC2 serial console without access keys
My goal is to connect to the serial console of an EC2 instance, using SSH, e.g. from a laptop, using the best modern security practices in setting it up. The AWS documentation (https://docs.aws.amazon....
0 votes
1 answer
818 views
Cannot create aws lambda function. error: the following arguments are required: --runtime, --handler
I am trying to deploy an image to be run in aws lambda at a scheduled interval. I have built and tested the image using RIE and locally it runs as it should. Next I have pushed the image to aws ecr to ...
1 vote
1 answer
217 views
aws efs describe-access-points no filters?
When I run aws efs describe-access-points --query 'AccessPoints[*].[AccessPointId]' --output table I get back 5 different ID's. There does not appear to be any filter options like there are for other ...
0 votes
0 answers
1k views
Amazon AWS CLI: How do I find out what actions/permissions/policies are attributed to a role?
I'm on Linux and using the AWS CLI. I tried running the following: aws iam list-instance-profiles-for-role --role-name role-abc-123 aws iam get-role --role-name role-abc-123 --query 'Role....
0 votes
0 answers
202 views
Switch to a different AWS accounts in the UI
I currently have AWS configuration set up with my access key id and secret access key (i.e. I see this when going to 'aws configure' in the CLI). I then login through my company's OKTA to then access ...
0 votes
1 answer
2k views
AWS CLI : How to use "--query" to get output from nested JSON
I am using aws-cli v2 to get the --query output from AWS Describe-volumes. In this, I am trying to get the volume id, size, Instance ID, state. Instance ID is nested in the AWS Describe-volumes. ...
1 vote
0 answers
60 views
How do I change a port restricted IP in a Lightsail instance via API?
I have a port that is IP-restricted in a Lightsail instance. How do I change that restricted IP via API or even aws-cli? I prefer via API using cURL. Thanks in advance.
1 vote
0 answers
609 views
How to add description to the aws security group ingress rule?
with below aws cli command. aws ec2 authorize-security-group-ingress --group-id sg-07b70f5d9078322f2 --protocol tcp --port 5439 --cidr 175.101.107.216/32 It is creating successfully, but can't find ...
0 votes
1 answer
1k views
"route53:ListHostedZones with an explicit deny" error in the AWS console despite having AmazonRoute53FullAccess permissions
I'm trying to run this command in the AWS console: aws route53 list-hosted-zones I'm using my access key/secret and it worked fine in a demo account. I checked with my team and I have the ...
0 votes
0 answers
297 views
How to locate a specific request in AWS, cloudtrail or Athena
How locate a specific request in AWS, cloudtrail or cloudwatch? Request on 2022-11-17T17:07:52.037Z General: Request URL: https://0712f1246-1104-y-https-www-abc-com.mplbci.ekb.eg/access HTTP Version: ...
0 votes
1 answer
532 views
Does AWS CLI bring data across local network when doing `aws s3 mv` between two S3 locations?
When moving data between two S3 locations using the AWS CLI, for example: aws s3 mv s3://bucket/prefix s3://bucket/other-prefix Is the data downloaded to your local computer and then re-uploaded? Or ...
1 vote
0 answers
254 views
AWS EC2 - Difference between adding interface via Bota3 vs adding via web interface
Apologies for dupes, I assume this is not novel, but I can't get the phrasing right to get an answer. I have a lambda python script provided by AWS from this example (python script reproduced below to ...
6 votes
1 answer
10k views
Why does an S3 to S3 copy care about VPCs? Related to error: "VPC endpoints do not support cross-region requests."
Goal: Get files from Bucket 1 in ca-central-1 in Account A to Bucket 2 in us-east-1 in Account B using the AWS CLI from a third machine using an the IAM role with correct S3 read and write ...
-1 votes
2 answers
3k views
Error to login ecr docker
I'm trying to login ecr with docker to upload the container, but it always returns an error. The cli configuration is ok. I'm following the documentation that aws provides, but still to no avail. ...
6 votes
2 answers
9k views
Copying files to/from EC2 instance using SSM alone (no SSH or S3 bucket)
I'm trying to setup a ready-to-run terraform template for some performance testing. It creates two EC2 instances in the same cluster placement group and preinstalls a bunch of tools. I don't know the ...
0 votes
0 answers
234 views
EC2 instance DNS resolving issue
How do I identify the EC2 instance causing DNS (my website) resolving errors? I have some instances in my VPC, one of them is creating an error, I did not enable monitoring for this VPC and the ...
1 vote
0 answers
78 views
Scripted upload to AWS cloudshell environment
We maintain dozens of developer accounts on AWS and for maintenance purposes it would be amazing if on all cloudshell environments we would have a set of scripts available. It is possible to upload ...
0 votes
1 answer
721 views
ssh: connect to host ec2-x-xxx-xxx-xx.compute-1.amazonaws.com port 22: Connection timed out
I connected to my ec2 instance successfully earlier. However, when trying to connect again, I got this error: ssh: connect to host ec2-x-xxx-xxx-xx.compute-1.amazonaws.com port 22: Connection timed ...
1 vote
0 answers
129 views
Reduce Query Syntax for ends_with()
I have the following query: --query "Contents[?ends_with(Key, 'jpg') || ends_with(Key, 'NEF') || ends_with(Key, 'nef') || ends_with(Key, 'CR2') || ends_with(Key, 'cr2')]" Is there a way to ...
0 votes
0 answers
1k views
S3 Fatal error: Failed to connect to proxy URL: "Proxy url"
Good Afternoon, I have been trying to remove some files from S3, last week I did not have any issues accessing my s3 bucket however now any s3 cmd fails with the error message above, I cant even run ...
1 vote
0 answers
120 views
Restoring a Windows VM automatically in AWS
We have a Windows 2012 R2 VM called test01 in AWS and it's used for automatic tests. There is another server which connects to the test VM for running some tests. Sometimes the tests mess up the VM. I'...
0 votes
1 answer
107 views
using terraform or aws cli how to enable/tick "Enable load balancing" when creating an application (codedeploy)
In AWS when creating a Codedeploy/application, how to enable the "Enable load balancing" option using the awscli or terraform? Using the command line I can only select/define the target ...
0 votes
2 answers
2k views
Get outputs from jq specific line
The command: create_subnet=$(aws ec2 create-subnet --vpc-id "$create_vpc" --cidr-block 10.0.1.0/24 | jq -r '.subnet[].subnetid') The output: "subnet": { "...
0 votes
1 answer
606 views
aws cli import access key in json format
With the aws cli (version 2) I have created an access key for an iam user, which produces json output. I pipe that output to a file. Now I would like to import these credentials to my aws cli ...
1 vote
1 answer
5k views
How to automate aws cli commands with shell script
I wonder anyone can help me with making a shell script which automate aws cli process for: 1.Creating Security group 2.Set roles to this Security group port 22 and port 80 3.Create a ec2 instance with ...
1 vote
1 answer
647 views
How can I find the list of instance types that do not require ENA and the list of AMIs that support ENA?
I have this Terraform file - terraform { required_providers { aws = { source = "hashicorp/aws" version = "~> 4.23" } } required_version = ">= ...
0 votes
1 answer
662 views
How to configure aws cli on ubuntu gitlab?
While trying to install and configure aws cli on ubuntu runner in pipeline, stuck at below screen. pipeline stuck How to do that?
1 vote
0 answers
2k views
How to connect aws instance with aws cli?
I don't have ssh key but I have access to aws portal and console where the ec2 machine is there. I tried using the steps in this link to connect ec2 instance. Method 1: using only instance-id and mssh ...
1 vote
1 answer
2k views
How to list all function apps and it's storage account
Is there anyway to combine both commands below where it lists all the function app together with the storage account used for it? This command gets all the function app in the subscription az ...
0 votes
0 answers
163 views
How to get aws account id from local configuration?
I'm well aware of the aws sts ... method but that requires a remote call. Is there a way to get my account id/number from local configuration?
1 vote
1 answer
19k views
How do I extract a list of all folders of my AWS S3 storage bucket or directories?
Does Amazon provide an easy way extract a list of all folders that have files greater than 500 MB from a s3 bucket? want to limit the scope to the '/files/ftp_upload/' directories also This is so I ...