Install and Configure Tools

In the Cloud9 workspace, run the following commands (note: choose one installation method from the tabs below and follow the same method throughout the rest of the tutorial) :

Install and setup prerequisites

# Install prerequisites 
sudo yum install -y jq

pip install --user --upgrade awscli

# Install copilot-cli
sudo curl -Lo /usr/local/bin/copilot https://github.com/aws/copilot-cli/releases/latest/download/copilot-linux && sudo chmod +x /usr/local/bin/copilot && copilot --help

# Setting environment variables required to communicate with AWS API's via the cli tools
echo "export AWS_DEFAULT_REGION=$(curl -s 169.254.169.254/latest/dynamic/instance-identity/document | jq -r .region)" >> ~/.bashrc
source ~/.bashrc

Install and setup prerequisites

# Install prerequisite packages
sudo yum -y install jq nodejs siege

# Install cdk packages
pip3 install --user --upgrade awslogs

#  Verify environment variables required to communicate with AWS API's via the cli tools
grep AWS_DEFAULT_REGION ~/.bashrc 
if [ $? -ne 0 ]; then
    echo "export AWS_DEFAULT_REGION=$(curl -s 169.254.169.254/latest/dynamic/instance-identity/document | jq -r .region)" >> ~/.bashrc
fi

grep AWS_REGION ~/.bashrc 
if [ $? -ne 0 ]; then
    echo "export AWS_REGION=\$AWS_DEFAULT_REGION" >> ~/.bashrc
fi

grep AWS_ACCOUNT_ID ~/.bashrc 
if [ $? -ne 0 ]; then
    echo "export AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)" >> ~/.bashrc
fi 

source ~/.bashrc