Deploy Infrastructure

Deploy Infrastructure

  1. First, to perform the lab, we need to initialize the resources using CloudFormation.
  • Download the CloudFormation template file here (the browser will automatically download the template.yaml file to your computer).
  • Go to the CloudFormation Console.
  • In the Choose an existing template section, select Upload a template file, upload the template.yaml file, and click Next.
  • Set the Stack name to wild-rydes-async-msg-0. For the KeyName parameter, select an existing SSH Key Pair on your AWS account (this is required to be able to connect via VS Code or MobaXterm later).
  • Review the configuration, click Next to the final step, and select Create stack.

Working with SNS Working with SNS Working with SNS Working with SNS

  1. Wait for about 5-10 minutes, the Stack will be created successfully.

Working with SNS

After the CloudFormation stack status changes to CREATE_COMPLETE, the EC2 instance needs an additional 1–2 minutes for its UserData bootstrap script to finish setting up Docker, AWS SAM CLI, and cloning the project repository into /home/ec2-user/wild-rydes-async-messaging.

  1. Select the Outputs tab of the newly created stack. Here you will see the SSHCommand and the VSCodeRemoteSSH information.

Working with SNS

  1. Connect to the workspace:

Open Visual Studio Code on your personal computer. Install the Remote - SSH extension (if you haven’t already).

  • Press Ctrl+Shift+P, type and select Remote-SSH: Add New SSH Host…

  • Paste the SSH command copied from the Outputs section (for example: ssh -i "<path_to_key_file.pem>" ec2-user@<IP_Public>) and press Enter. Working with SNS Working with SNS Working with SNS

  • Press Ctrl+Shift+P again, type and select Remote-SSH: Connect Current Window to Host… Working with SNS

  • Select workshop-59 -> choose Linux and Continue Working with SNS

  • After a successful connection, select Open Folder and open the directory /home/ec2-user/wild-rydes-async-messaging then click OK. Your environment has been automatically set up with all the necessary tools! Working with SNS Working with SNS

Option 2: Using MobaXterm

Alternatively, you can use MobaXterm to SSH into the EC2 instance:

  • Download and install MobaXterm Home Edition.

  • Open MobaXterm, click on the Session button at the top-left corner, and select SSH:

    • Remote host: Enter the EC2 Public IP address from the Outputs tab
    • Check Specify username and enter ec2-user.
    • Go to the Advanced SSH settings tab, check Use private key, and browse to your private key file (.pem) from your CloudFormation.
    • Click OK to establish the connection. Working with SNS Working with SNS
  • Once connected, navigate to the workshop directory:

    cd ~/wild-rydes-async-messaging
    

Working with SNS