Setup CloudShell

Setup CloudShell environment

The CloudShell environment automatically uses your IAM permissions, so you don’t need to configure an IAM Role like you would for an EC2 instance.

  1. Copy and paste the command below into the CloudShell Terminal to install text processing tools.
sudo yum -y install jq gettext bash-completion

Amazon CDk

  1. Similar to CloudFormation, you can install the cfn-lint tool to help check CDK templates and other information, including verifying if resource properties are correct or if the configuration follows best practices.
pip install cfn-lint

Amazon CDk

  1. Verify that cfn-lint was installed successfully by running:
cfn-lint --version

Amazon CDk

  1. We will configure the aws cli to use the current Region.
export ACCOUNT_ID=$(aws sts get-caller-identity --output text --query Account)
export AWS_REGION=$AWS_REGION
export AZS=($(aws ec2 describe-availability-zones --query 'AvailabilityZones[].ZoneName' --output text --region $AWS_REGION))

Amazon CDk

  1. We will save the configuration information into bash_profile.
echo "export ACCOUNT_ID=${ACCOUNT_ID}" | tee -a ~/.bash_profile 

echo "export AWS_REGION=${AWS_REGION}" | tee -a ~/.bash_profile                                                                                                                           

echo "export AZS=(${AZS[@]})" | tee -a ~/.bash_profile                                                                                                                                    

aws configure set default.region ${AWS_REGION}

Amazon CDk

  1. Check if the CDK CLI is installed by running:
cdk --version

Amazon CDk

  1. Check your current IAM identity in CloudShell:
aws sts get-caller-identity

Amazon CDk