Wandering Journey

Jounaling the travel from one subject to another, often with no definite destination or purpose...

AWS 3-in-1 Hands On Lab Exercise #2 - EC2 Basics #02

13 January 2021

Outline of exercise

  • Create a new Ubuntu Server 20.04 LTS (HVM), SSD Volume Type instance in you default VPC
  • Use the t2.micro instance type
  • Use a Name tag of ec2_ubuntu
  • Create a new Security Group named sg_ubuntu that permits ssh from anywhere
  • Launch the instance and update Ubuntu
    • sudo apt update && sudo apt upgrade
  • Install the stress utility
    • sudo apt install stress
  • Shutdown your instance

Connect to instance

Amazon EC2 Instance Connect provides a simple and secure way to connect to your instances using Secure Shell (SSH).

Session Manager is a fully managed AWS Systems Manager capability that lets you manage your Amazon EC2 instances, on-premises instances, and virtual machines (VMs) through an interactive one-click browser-based shell or through the AWS CLI

EC2 Instance Connect

Instance ID i-0b95632df44dbd361 (ec2_ubuntu) Public IP address 52.14.183.130 User name XXXXX

Session Manager

Session Manager usage: Connect to your instance without SSH keys or a bastion host. Sessions are secured using an AWS Key Management Service key. You can log session commands and details in an Amazon S3 bucket or CloudWatch Logs log group. Configure sessions on the Session Manager Preferences page.

ssh client

Instance ID i-0b95632df44dbd361 (ec2_ubuntu)

  1. Open an SSH client.
  2. Locate your private key file. The key used to launch this instance is kp_aws3in1.pem
  3. Run this command, if necessary, to ensure your key is not publicly viewable.
    • chmod 400 kp_aws3in1.pem
  4. Connect to your instance using its Public DNS:
    • ec2-52-14-183-130.us-east-2.compute.amazonaws.com

Example:

ssh -i "kp_aws3in1.pem" XXXXX@ec2-52-14-183-130.us-east-2.compute.amazonaws.com

install the ‘stress utility

Example:

sudo apt install stress

shutdown the instance