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.
42
votes
permission denied on AWS Transfer on SFTP server
User Role should be:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowListingOfUserFolder",
"Action": [
"s3:ListBucket",
...
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 ...
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://...
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-...
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 ...
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 ...
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
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-...
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 ...
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 ...
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-...
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 ...
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.
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-...
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 ...
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 ...
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 ...
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 ...
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.
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 ...
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.
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 ...
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 ~/....
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:// ...
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-...
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 ...
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.
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
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
amazon-web-services × 982amazon-ec2 × 270
linux × 157
ssh × 112
ubuntu × 87
networking × 83
amazon-s3 × 81
dns × 47
vpn × 32
putty × 31
docker × 28
command-line × 24
windows × 23
sftp × 21
bash × 20
apache-http-server × 20
openvpn × 20
amazon-vpc × 19
ftp × 18
email × 17
ssl × 16
permissions × 15
python × 15
windows-10 × 14
virtual-machine × 14