Questions tagged [aws-cli]

aws-cli is the Amazon Web Services Command Line Interface

Filter by
Sorted by
Tagged with
2 votes
2 answers
234 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 ...
0 votes
2 answers
849 views

AWS Inline Policy to Limit Automation Document Execution per IAM

AWS Inline Policy to Limit Automation Document Execution per IAM is my goal, but understanding current limitations I can see that I can only use * wildcard and can't specify a specific document. Is ...
25 votes
2 answers
47k views

Deleting S3 files with a given prefix only

We have a bucket with more than 500,000 objects in it. I'm assigned a job where I've to delete files which have a specific prefix. There are around 300,000 files with the given prefix in the bucket. ...
1 vote
1 answer
35 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-...
0 votes
3 answers
5k views

Jenkins Server - trying to run AWS cli script - getting an error

I am running a Jenkins server on Windows server with AWS CLI installed. while trying to run a script through Jenkins job i get the following error: "You must specify a region. You can also configure ...
2 votes
2 answers
12k views

User is not authorized to perform: iam:PassRole on resource

I'm attempting to create an eks cluster through the aws cli with the following commands: aws eks create-cluster --name ekCsluster --role-arn arn:aws:iam::111111111111:role/eksServiceRole --resources-...
6 votes
2 answers
3k views

AWS Root volume Encryption

In my scenario, I have some old EBS volumes that are not encrypted. To satisfy new corporate security measures, all data needs to be encrypted so I need to compile a plan to encrypt the unencrypted ...
4 votes
1 answer
5k views

Parameter parsing when using AWS SSM send-command from Terraform

I am using AWS SSM send-command to run a PowerShell script on an AWS instance. The following commanad works fine in a command shell but when called in Terraform gets an error. aws ssm send-command ...
2 votes
1 answer
466 views

How to name or rename an EIP in AWS?

Somehow, at some point, I created 2 EIPs and gave them names (they have names in the EC2 UI). But now I cannot figure out, or find in the docs, how to name EIPs either when creating them or after ...
1 vote
1 answer
67 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 ...
1 vote
1 answer
151 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
1 answer
334 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 ...
0 votes
0 answers
4k 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 ...
1 vote
1 answer
12k 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 ...
0 votes
2 answers
353 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 ...
9 votes
4 answers
21k views

Why can't I capture AWS EC2 CLI Output in Bash?

I am trying to capture the output of an aws ec2 delete-snapshot in a Bash script command but I cannot get anything to capture the output. I have tried result=$(command), result=`command` etc. but when ...
0 votes
0 answers
324 views

AWS ECR Tag Based Access Control

$ docker pull {ACCOUNT-ID}.dkr.ecr.{region}.amazonaws.com/{repository-name}:ecr Error response from daemon: pull access denied for {ACCOUNT-ID}.dkr.ecr.ap-south-1.amazonaws.com/{repository-name}, ...
0 votes
1 answer
226 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 --...
3 votes
1 answer
2k views

Aws cli: The filter condition returns all the running instance instead of those with a particular tag

I want to able find out the ec2 machines that are running and tagged with a particular value. I used the following command: aws ec2 describe-instances --filter Name=tag:Name,Values=worker1 \ --...
0 votes
0 answers
683 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 (...
16 votes
3 answers
24k views

How to add a Tag when launching an ec2 instance using aws clis

I am trying to create an instance in ec2 using CLI. Is there anyway to specify tags to the instance when using CLI to create instances? aws ec2 run-instances --image-id $ami_id --key-name $...
0 votes
0 answers
128 views

Enable MFA S3 delete

I have THALES TOTP hardware tokens (MFA) which I would like to use as and additional protection against the accidental S3 object deletion (https://docs.aws.amazon.com/AmazonS3/latest/userguide/...
0 votes
1 answer
334 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 = ">= ...
5 votes
10 answers
25k views

AWS EKS update-kubeconfig does not respect --role-arn flag

Whenever I run the following command with the role that that was used to create the eks cluster... aws eks update-kubeconfig --name eks-cluster --role-arn arn:aws:iam::999999999999:role/...
2 votes
3 answers
4k views

aws ssm start-session .. AWS-StartPortForwardingSession .. hangs

I am trying to set up port forwarding between my local PC and an AWS EC2 based on the AWS SSM port forwarding article instance like this: aws ssm start-session --target i-0822c9a6c52ca7394 \ --...
-2 votes
1 answer
118 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
1k 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....
3 votes
2 answers
6k views

`Access Denied` for some files, when syncing buckets

I'm using awscli to sync 2 buckets (same account): aws s3 sync --only-show-errors s3://bucket-1 s3://bucket-2 but for some files I get permission errors: copy failed: s3://bucket-1/dirname/file....
0 votes
1 answer
473 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 ...
14 votes
2 answers
37k views

Is there any way of viewing, in AWS, what ips in a subnet have been allocated?

Is there any way of seeing what ip addresses AWS thinks have been allocated in a subnet? I've run a ping scan, and I've checked our internal ip management software, and there should be more than 8 ips ...
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....
1 vote
2 answers
2k views

aws s3 sync - skip "system" folders on windows

I'm attempting to use aws s3 sync to push a bunch of backup files from my Windows server to an s3 bucket. The problem that I'm running into is that it appears to be picking up the Recycle Bin and ...
2 votes
2 answers
3k views

Can't use execute-command --interactive in AWS CLI session manager

I'm trying to use the AWS cli + session manager plugin to get into a database container to run some migrations, and I am struggling to get it working. I'm trying to use the following command: aws ecs ...
18 votes
5 answers
34k views

Is it possible to get aws ec2 instance id based on its IP address

I have list of IP addressed, I want to find if instances associated with the IP address are still running or terminated. I am launching and terminating lot of instances on daily basis, just want to ...
0 votes
1 answer
1k 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. ...
0 votes
0 answers
62 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
2 answers
901 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": { "...
1 vote
0 answers
42 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
524 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
736 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
1 answer
207 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 ...
0 votes
0 answers
202 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: ...
1 vote
0 answers
207 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 ...
1 vote
1 answer
2k views

AWS IAM role RDS authentication failure

Trying to create a process for IAM role based authentication to my RDS instance per AWS wiki, but no matter what I seem to do I get a basic auth failure akin to a bad password, with no logging ...
2 votes
1 answer
6k 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 ...
3 votes
2 answers
7k views

awscli v2 needs sudo to run otherwise get permission denied error ubuntu 20.04.01

I've installed the awscli V2 as per the official AWS instructions here: $ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" $ unzip awscliv2.zip $ ...
0 votes
1 answer
551 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 ...
21 votes
3 answers
39k views

How to find out an ec2 instance's private and public IP via aws cli?

Answers I found so far (e.g. Find out public ip address of the EC2 server) suggest using wget or curl to reach the server. They are not useful for me because my ec2 instances are not reachable from ...
-1 votes
2 answers
2k 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. ...
0 votes
1 answer
481 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
2 3 4 5
8