Setup Cloud9 Ubuntu 1804


AWS Cloud9 CLI

Create a new Cloud9 in ap-east-1.


Linux Update

Run:

sudo apt update
sudo apt upgrade

Output:


Update AWS CLI

Check current AWS CLI version. It should be version 1.x

Run:

aws --version

Output:

aws-cli/1.8.3 Python/3.9.11 Linux/5.4.0-1086-aws exe/x86_64.ubuntu.18 prompt/off

Update AWS CLI

Run:

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
/usr/local/bin/aws --version

Output:

[...]
aws-cli/2.8.3 Python/3.9.11 Linux/5.4.0-1086-aws exe/x86_64.ubuntu.18 prompt/off

Reboot to use the CLI version 2.

Run:

sudo reboot

Output:

Cloud9 is rebooting and wait for 1 min to connect to your Cloud9 again.

Install Python SDK boto3

Run:

pip3 install boto3

Output:


Setup/Check AKSK

Setup AKSK

Run:

aws configure

Output:

Read current temperary AKSK

Run:

cd ~/.aws
more credentials

Output:

# Do not modify this file, if this file is modified it will not be updated. If the file is deleted, i
t will be recreated on Mon Oct 17 2022 03:59:34 GMT+0000 (Coordinated Universal Time).
# cc2ac3f11365c46d67a21bc6a53f7effaef3704fbc4ea9e58554655175823d2c #

aws_access_key_id=ASIAZJY3635BTUAYXEWQ aws_secret_access_key=VKetTtWt3VDHEcyiYyDQ8lZhfCJxYUi5wtXiEkci aws_session_token = region=ap-east-1


Role

Check current IAM Role

Run:

aws sts get-caller-identity

Output:

Check other Role

Run:

aws sts get-caller-identity --query Arn

Output:

"arn:aws:sts::639471902531:assumed-role/eksworkshop-admin/i-0c7bf0fd7e7197e91"

jq

Install jq

we can display a beautified json in terminal by using jq. We can find more details in jqplay.org

Run:

apt install jq

Output:

Test jq

Run:

aws ec2 describe-instances | jq '.HostedZones[].Name'

Output:

x

,