Setup Workspace

Create new EC2 to deploy all the code

Create key pair

  1. Go to Key pairs (ap-northeast-1 region) or Key pairs (cn-north-1 region)
  2. Set Name: gcr-rs-dev-workshop-ec2-key

Create key pair

  1. Suppose you are using Mac, save the key pair to you local disk, eg: ~/Downloads

  2. Open an SSH client, run this command, to ensure your key is not publicly viewable

    cd ~/Downloads
    chmod 400 gcr-rs-dev-workshop-ec2-key.pem
    

Create new EC2 instance

  1. Go to CloudFormation (ap-northeast-1 region) or CloudFormation (cn-north-1)

    CloudFormation template:

    • AWS Global region:
     https://aws-gcr-rs-sol-workshop-ap-northeast-1-common.s3.ap-northeast-1.amazonaws.com/rs-dev-workshop-code/release/v2.0.1/rs-raw-ec2.yaml
    
    • AWS China region:
    https://aws-gcr-rs-sol-workshop-cn-north-1-common.s3.cn-north-1.amazonaws.com.cn/rs-dev-workshop-code/release/v2.0.1/cn-rs-raw-ec2.yaml
    

    EC2 CloudFormation

  2. Stack name: gcr-rs-dev-workshop-ec2 KeyPairParam: gcr-rs-dev-workshop-ec2-key

    EC2 CloudFormation Stack

  3. Click Next -> Next -> Create Stack

    EC2 CloudFormation Create

  4. Wait CloudFormation deployment complete

    This will take about 5 - 6 minutes to provision

  5. Get CloudFormation output EC2 CloudFormation Output

  6. Open an SSH client, connect to your instance, replace <EC2_IP_Address> with the EC2 IP

    cd ~/Downloads
    HOST_IP=<EC2_IP_Address>
    ssh -i "gcr-rs-dev-workshop-ec2-key.pem" ec2-user@${HOST_IP}
    
  7. Type yes when showing the messages below.

    Connect-to-ec2

  8. Check your EC2 environment and related tools

    eksctl version
    kubectl version --client
    aws configure get default.region
    echo $REGION
    

    If the output is empty or error, please run tail /var/log/user-data.log to check the init log, maker sure init script finished successfully, then re-login the EC2.