87 votes
Accepted

Is there a way to list available/configured AWS CLI profiles?

You can list profiles in your aws config/credential files using list-profiles: aws configure list-profiles This is working for me with aws-cli version 2.0.8.
Dustin Hooten's user avatar
42 votes

permission denied on AWS Transfer on SFTP server

User Role should be: { "Version": "2012-10-17", "Statement": [ { "Sid": "AllowListingOfUserFolder", "Action": [ "s3:ListBucket", ...
Algeriassic's user avatar
  • 1,649
30 votes

parsing json in bash with pipe operators

Yes, there are several different tools that have a full JSON parser and some form of query language (along the lines of XML having XPath). jq -r .DBClusterSnapshots[0].Status jshon -e ...
u1686_grawity's user avatar
25 votes

AWS upload folder to S3 as tar.gz without compressing locally

What you're really looking for is not saving a local file. You can use pipes to send the data from tar through gzip to s3 without saving anything to disk. tar c /var/test | gzip | aws s3 cp - "s3://...
Bob's user avatar
  • 61.7k
22 votes
Accepted

parsing json in bash with pipe operators

The AWS CLI tools have a built-in --query parameter that accepts a JMESPath expression to select a subset of the JSON output. Your example would look something like this: aws rds describe-db-cluster-...
grnch's user avatar
  • 335
20 votes

aws --version error: bash: /usr/bin/aws: No such file or directory

It turns out the problem was that bash had cached the path /usr/bin/aws from a previous install of an old version 1 of aws cli. Prior to the commands shown in my question, I had deleted the old ...
Dennis G Allard's user avatar
18 votes

Time machine backup on S3

Using AWS S3 as the storage of Mac Time Machine definitely works now. Time Machine can backup the data to external device, so the key is mounting S3 bucket as a POSIX FS in Mac. There are many tools ...
Kane's user avatar
  • 505
16 votes
Accepted

Unable to run AWS CLI: "ImportError: cannot import name 'docevents' from 'botocore.docs.bcdoc'"

try running pip3 install --upgrade awscli or pip install --upgrade awscli
FITNERD's user avatar
  • 176
15 votes

Is there a way to list available/configured AWS CLI profiles?

(Answering my own question.) No, there is not. I wrote two scripts that include the parsing I ended up using. For anyone interested, they're available in two GitHub repositories: awscli-mfa and aws-...
Ville's user avatar
  • 3,112
15 votes

Is there a way to list available/configured AWS CLI profiles?

Parsing ~/.aws/credentials was simple enough for me. $ cat ~/.aws/credentials | grep -o '\[[^]]*\]' => [default] [other_profile] [other_profile2] I also aliased the command into aws-profiles by ...
thedanotto's user avatar
14 votes
Accepted

How to ssh from one ec2 instance to another?

Method 1 - use the same keys on the servers: Convert the keys to openssh format and upload the private keys to the servers. When you ssh to the destination host, specify the private key file: ssh -i ...
matiu's user avatar
  • 276
12 votes

AWS CLI, using `--cli-input-json` in a pipeline

Found a workaround for the time being with xargs that is quite clean: cat ./mytask.json \ | xargs -0 aws ecs register-task-definition --cli-input-json It only adds xargs -0 and requires --cli-...
166_MMX's user avatar
  • 1,421
11 votes
Accepted

SSH via multiple hosts or bastions

Method 1 – onion (nested tunnels) With OpenSSH 7.3 and later: Host webserverA ProxyJump bastionA,bastionB The same via command line: $ ssh -J bastionA,bastionB webserverA Alternatively (also ...
u1686_grawity's user avatar
9 votes
Accepted

In elasticbeanstalk, can I ssh in and manually restart the (node) app?

To modify the running code, edit the files in: /var/app/current Then, running: sudo pkill -f node will cause your node app to be restarted, with the latest code running.
jaynp's user avatar
  • 218
9 votes
Accepted

AWS allow user to call create-role

If you have root access to your account, you can just write your own policy and attach it to the user (AWS Console => IAM => Users => Add inline policy). Here is an example: { "Version": "2012-10-...
Sergey Kovalev's user avatar
9 votes
Accepted

How to solve 404 Error in AWS apg-get for debian jessie fetch?

The error has nothing to do with Amazon or with your CircleCI configuration. Jessie's repos have moved to debian's archive and you need to update the following file: /etc/apt/sources.list The new ...
Fanatique's user avatar
  • 4,648
8 votes

AWS Load Balancer is slow?

The reason for the delay is because you have the ELB setup for multi-az without any application instances in the other 2 AZ's configured. Without instances in those AZ's requests will tend to fail ...
Gurumahesh's user avatar
8 votes
Accepted

Unable to mount Elastic File System on EC2 (mount.nfs4: Connection timed out)

You probably need to create inbound policies. From the amazon documentation: The file system must have a mount target whose network interface has a security group with a rule than enables inbound ...
Jorge's user avatar
  • 96
8 votes

How to ssh from one ec2 instance to another?

There is a 3rd and IMHO the best solution so called ssh agent forwarding: on local machine configure ~/.ssh/config, by adding following section: Host <ip-or-name-of-A-server> ForwardAgent ...
Robert Lujo's user avatar
8 votes

AWS upload folder to S3 as tar.gz without compressing locally

tar cvfz - /var/test | aws s3 cp - s3://tests/test1.tar.gz You don't have to separately gzip; tar does that for you with the z option. This works both in directions.
Robv's user avatar
  • 81
8 votes

scp command silently does nothing

You are missing a colon (:) after the "target" argument: scp -i learndeepai.pem sb_code.zip [email protected].***: Without the colon, the command is an equivalent to cp, so it copies learndeepai.pem ...
Martin Prikryl's user avatar
8 votes

aws --version error: bash: /usr/bin/aws: No such file or directory

I ran into the same issue. I closed the terminal session and re-opened it and the aws command worked correctly.
raypat's user avatar
  • 101
7 votes

How to install let's Encrypt on Amazon Linux

Amazon's EPEL doesn't seem to have certbot for me. Try manually installing it, here's a pair of articles with full instructions: Try https://ivopetkov.com/b/let-s-encrypt-on-ec2/ for Apache Or ...
Philippe Chaintreuil's user avatar
7 votes
Accepted

Can you recover ~/.ssh contents on AWS EC2 with an open session and keys?

You cannot recover it. But as long as you have your session open, you can re-create the authorized_keys the same way, you would create it for the very first time on a normal *nix system. create ~/....
Martin Prikryl's user avatar
7 votes
Accepted

AWS CLI, using `--cli-input-json` in a pipeline

I went digging... It looks like aws will read the indicated file twice, using the second dataset for it's operation. Of course, in a pipeline, the second read() will get nothing. I've added a pipe:// ...
Attie's user avatar
  • 20k
7 votes

Know the identity behind an AWS canonical ID

The AWS documentation at https://docs.aws.amazon.com/AmazonS3/latest/dev/example-walkthroughs-managing-access-example4.html says: The canonical user ID is the Amazon S3–only concept. It is a 64-...
Alastair Irvine's user avatar
7 votes

How do I setup ftp/sftp on aws

If you don't want to use AWS Transfer for SFTP, it is possible to set up your SFTP server directly from an EC2 instance. If you follow correctly these instructions you should be able to create ...
smallwat3r's user avatar
7 votes

AWS cloudwatch failed to execute action. Error: ""

I had this error because I was setting the "metric interval upper bound" to 0 instead of setting the lower bound.
magnetik's user avatar
  • 269
7 votes
Accepted

Cannot install Nginx on AWS EC2 AMI2 - Topic :topic: is not found

You need to do the following: Type amazon-linux-extras to list the packages that are there, and copy the version of nginx, for example nginx1.2 Then type sudo amazon-linux-extras install nginx1.2
Algeriassic's user avatar
  • 1,649
6 votes
Accepted

What does it mean On-Premises and Colocation? What is the difference between them

From my personal experience, On-premises and Colocation are similar in that the customer owns the equipment that is in question. The difference is where the equipment is located at. On-premises ...
Blerg's user avatar
  • 1,232

Only top scored, non community-wiki answers of a minimum length are eligible