Skip to content

Instantly share code, notes, and snippets.

@evmin
Last active October 29, 2021 03:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evmin/e21bf18ad639552c6f059f8643e28698 to your computer and use it in GitHub Desktop.
Save evmin/e21bf18ad639552c6f059f8643e28698 to your computer and use it in GitHub Desktop.
# [ tools ]
sudo yum -y install jq nodejs siege
# Install ecs cli for local testing
sudo curl -so /usr/local/bin/ecs-cli https://s3.amazonaws.com/amazon-ecs-cli/ecs-cli-linux-amd64-latest
sudo chmod +x /usr/local/bin/ecs-cli
# [ env ]
export AWS_DEFAULT_REGION=$(curl -s 169.254.169.254/latest/dynamic/instance-identity/document | jq -r '.region')
export ACCOUNT_ID=$(aws sts get-caller-identity --output text --query Account)
echo export ACCOUNT_ID=${ACCOUNT_ID} >> /home/ec2-user/.bash_profile
echo export AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION} >> /home/ec2-user/.bash_profile
echo export AWS_REGION=${AWS_DEFAULT_REGION} >> /home/ec2-user/.bash_profile
# [ cdk ]
export AWS_CDK_VERSION="1.129.0"
# Install aws-cdk
npm install -g npm@8.1.1
npm install -g --force aws-cdk@$AWS_CDK_VERSION
# Install cdk packages
pip3 install --user --upgrade aws-cdk.core==$AWS_CDK_VERSION \
aws-cdk.aws_ecs_patterns==$AWS_CDK_VERSION \
aws-cdk.aws_ec2==$AWS_CDK_VERSION \
aws-cdk.aws_ecs==$AWS_CDK_VERSION \
aws-cdk.aws_servicediscovery==$AWS_CDK_VERSION \
aws_cdk.aws_iam==$AWS_CDK_VERSION \
aws_cdk.aws_efs==$AWS_CDK_VERSION \
aws_cdk.aws_appmesh==$AWS_CDK_VERSION \
awscli \
awslogs
# [ cloning workshop repo ]
cd ~/environment
git clone https://github.com/aws-containers/ecsdemo-platform
git clone https://github.com/aws-containers/ecsdemo-frontend
git clone https://github.com/aws-containers/ecsdemo-nodejs
git clone https://github.com/aws-containers/ecsdemo-crystal
# Role Creation
aws iam get-role --role-name "AWSServiceRoleForElasticLoadBalancing" || aws iam create-service-linked-role --aws-service-name "elasticloadbalancing.amazonaws.com"
aws iam get-role --role-name "AWSServiceRoleForECS" || aws iam create-service-linked-role --aws-service-name "ecs.amazonaws.com"
# Session Manager Plugin
curl "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/linux_64bit/session-manager-plugin.rpm" -o "session-manager-plugin.rpm"
sudo yum install -y session-manager-plugin.rpm
/usr/local/bin/session-manager-plugin
# Reboot
sudo reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment