- Follow the document: Launch an Amazon EC2 Instance to launch the EC2 instance.
- Follow the document to create an IAM role with the proper permission and attach an IAM Role to an EC2 Instance. In this workshop, the deployment scripts will deploy troubleshooting environment by creating CloudFormation stacks, you can attach AWS managed policy
arn:aws:iam::aws:policy/AdministratorAccess
to the IAM role. (This IAM role is used to in this workshop, not recommend use the IAM role in practical or production environment.) - Follow the document to set up the proper security group for the EC2 instance to allow you can SSH into it.
- Install the Git and pull the workshop materials:
sudo yum install -y git
git clone https://github.com/0xlen/ecs-workshop
NOTE: If you already have a general SSH key pair in all AWS region, you can skip this step.
Login to the EC2 instance and set up the key pair name by define ECS_WORKSHOP_KEY_PAIR
variable:
export ECS_WORKSHOP_KEY_PAIR=ecs-workshop
Create and import the key pair to all AWS region:
$ ./create-ecs-workshop-key-pair.sh
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/ec2-user/.ssh/ecs-workshop.
Your public key has been saved in /home/ec2-user/.ssh/ecs-workshop.pub
...
Import key pair: ecs-workshop in ap-south-1 ...
{
"KeyName": "ecs-workshop",
"KeyFingerprint": "XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX"
}
...
Import key pair: ecs-workshop in us-west-2 ...
{
"KeyName": "ecs-workshop",
"KeyFingerprint": "XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX"
}
Login to the EC2 instance and select an AWS region for deploying the environment by setting ECS_WORKSHOP_REGION
. To prevent hit the number of default VPC limit, please select the region to have sufficient capacity can create 3 VPC.
Example:
export ECS_WORKSHOP_REGION=ap-southeast-1
Deploy the troubleshooting environment:
[ec2-user@host ecs-workshop]$ cd ecs101/troubleshooting/
[ec2-user@host ecs-workshop]$ ./deploy.sh
[ec2-user@host ecs-workshop]$ ./deploy.sh reset
[ec2-user@host ecs-workshop]$ ./deploy.sh clean
Deploy Fargate troubleshooting environment:
cd ecs200/troubleshooting/
export ECS_WORKSHOP_REGION=eu-west-1
./deploy_fargate.sh FargateCannotRunTasksConcurrency
export ECS_WORKSHOP_REGION=us-west-2
./deploy_fargate.sh
Deploy EC2 troubleshooting environment:
cd ecs200/troubleshooting/
export ECS_WORKSHOP_REGION=ap-southeast-2
./deploy_ec2.sh
cd ecs200/troubleshooting/
export ECS_WORKSHOP_REGION=eu-west-1
./deploy_fargate.sh clean
export ECS_WORKSHOP_REGION=us-west-2
./deploy_fargate.sh clean
export ECS_WORKSHOP_REGION=ap-southeast-2
./deploy_ec2.sh clean