Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save the-vishal-kumar/6e295bc8f08ff46f4a08456d0c9222c7 to your computer and use it in GitHub Desktop.
Save the-vishal-kumar/6e295bc8f08ff46f4a08456d0c9222c7 to your computer and use it in GitHub Desktop.
Tutorial: AWS - Create EC2 Instance and Connect via SSH
  1. Go to https://console.aws.amazon.com/
  2. Signup/Signin using your credentials
  3. Go to EC2 service
  4. Click on Launch Instance
  5. Name and tags
    1. Fill in the name, e.g. fungyaan
  6. Application and OS Images
    1. Choose OS, e.g. Ubuntu
  7. Key pair
    1. Click on Create new key pair
    2. Fill in the Key pair name, e.g. fungyaan-frankfurt
    3. Choose .pem
    4. Click create Create key pair button to download the .pem file
  8. Network settings
    1. Choose Create security group
    2. Check Allow SSH traffic from Anywhere 0.0.0.0
    3. Check Allow HTTPS traffic from the Internet
    4. Check Allow HTTP traffic from the Internet
  9. Configure storage
    1. Fill 30 GiB. You can choose a maximum of 30GB EC2 instance on Free Tier
    2. Choose gp3 from the dropdown
  10. Click on the Launch Instance button
  11. Congratulations! You have success fully initiated launch of an EC2 instance. You'll be redirected to Success page
  12. Scroll down and click on View all instances
  13. You'll be redirected to a list of your instances. Once the Instance state and _Status check_changes to Running and 2/2 checks passed, then click on the Instance ID corresponding to your newly created instance
  14. Copy Public IPv4 DNS, e.g. ec2-18-195-20-82.eu-central-1.compute.amazonaws.com
  15. Open terminal, write the command as sudo ssh -i <path-to-.pem-file> ubuntu@<public-ipv4-dns>, e.g. sudo ssh -i fungyaan-frankfurt.pem ubuntu@ec2-18-195-20-82.eu-central-1.compute.amazonaws.com
    1. If prompted password, write your computer user's password and press enter
    2. If prompted about authenticity of the host, write yes and press enter
  16. Congratulations! You have successfully established an SSH connection with your newly created EC2 instance. Any commands you write here, are executed on the connected EC2 instance.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment