Create Workspace (EC2)

The EC2 environment initialization process takes about 3-5 minutes

Create Workspace using EC2 and VS Code

We will use an Amazon EC2 instance combined with Visual Studio Code (Remote - SSH) as a workspace. This environment will be provisioned with a 30GB hard drive and pre-installed with Docker, Git, …

  1. First, we need to automatically provision resources using AWS CloudFormation.
  • First, download the CloudFormation template file here (the browser will automatically download the template.yaml file to your computer).

  • Access the CloudFormation Console on AWS.

  • Click Create Stack, in the Choose an existing template section, select Upload a template file and upload the downloaded template.yaml file, click Next.

  • Set the Stack name to ekscicd-workspace. For the KeyName parameter, choose an existing SSH Key Pair in your AWS account (if you don’t have one, you need to go to the EC2 Console to create a Key Pair first). Create Workspace

  • Review the configuration, continuously click Next until the final step, then select Submit. Create Workspace

  1. Wait for about 3-5 minutes, the Stack will be created successfully with the status CREATE_COMPLETE. Create Workspace

  2. Select the Outputs tab of the newly created stack. Here you will see the SSHCommand and the IP address information of the instance.

    • The SSH command will look like: ssh -i <YOUR_KEY.pem> ec2-user@<IP_Public> Create Workspace
  3. Open Visual Studio Code on your personal computer. Make sure you have installed the Remote - SSH extension.

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

  • Paste the copied SSH command above (remember to change <YOUR_KEY.pem> to the actual path to your Key Pair file) and press Enter. Create Workspace Create Workspace

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

  • Select the newly configured host -> select Linux and Continue to connect.

  1. After successfully connecting, you can open a new Terminal in VS Code (Ctrl + ~) and start running the lab commands. Create Workspace