LAUNCHING EC2 INSTANCE ON AWS

HOW TO USE AMAZON WEB SERVICES TO LAUNCH AND CONNECT TO AN EC2 INSTANCE
4

SSH, COMMAND LINE

EASY

last hacked on Nov 29, 2017

# Creating The Instance --- ## Step 1: Getting started * After logging into your AWS account, you will see a "Services" drop down menu in the top left corner. Select EC2 under the "Compute" section to get started. <img src=https://raw.githubusercontent.com/kaizenraizen/AWSEC2Setup/master/images/step1.png width="" height=""> * On the next page you'll see a section that says "Create Instance". Click on "Launch Instance" <img src=https://raw.githubusercontent.com/kaizenraizen/AWSEC2Setup/master/images/step2.png width="" height=""> ## Step 2: Configuration * You'll have several different options for what Operating System (OS) to run on your instance. We will select Ubuntu. <img src=https://raw.githubusercontent.com/kaizenraizen/AWSEC2Setup/master/images/step3.png width="" height=""> * Your instance type will depend on what you intend on doing with your instance. For the purposes of this tutorial I just chose the t2.micro General Purpose instance. After selecting your instance type you can go through and configure the rest of it. <img src=https://raw.githubusercontent.com/kaizenraizen/AWSEC2Setup/master/images/step4.png width="" height=""> * Here you can change the size of the disk space (basically just file system storage) allocated for your instance. <img src=https://raw.githubusercontent.com/kaizenraizen/AWSEC2Setup/master/images/step6.png width="" height=""> * By default your instance will have port 22 open so you can SSH into it. At this point you should open all of the ports you will need when using your instance. For example, if you want to host a website, you'll want to add HTTP (port 80), HTTPS(port 443). <img src=https://raw.githubusercontent.com/kaizenraizen/AWSEC2Setup/master/images/step7.png width="" height=""> ## Step 3: SSH Key Pair * If you don't already have keys set up to use when you SSH into your instance, this is where you'll want to generate a new key by selecting "Create a new key pair". I named my key "EC2Setup"; it will have a .pem file extension. <img src=https://raw.githubusercontent.com/kaizenraizen/AWSEC2Setup/master/images/step8.png width="" height=""> <img src=https://raw.githubusercontent.com/kaizenraizen/AWSEC2Setup/master/images/step9.png width="" height=""> <img src=https://raw.githubusercontent.com/kaizenraizen/AWSEC2Setup/master/images/step10.png width="" height=""> # Connecting to The Instance --- * Click on "Connect". This will show you the next steps to take to SSH into your instance. <img src=https://raw.githubusercontent.com/kaizenraizen/AWSEC2Setup/master/images/step11.png width="" height=""> * Open a command line and navigate to the Key that you downloaded during the keygen process, this is EC2Setup.pem in my case. Then execute chmod 400 (key.pem). This is to give the key proper permissions to be used with the ssh command. Then you can copy and paste the ssh command in the window that popped up when you hit "Connect". <img src=https://raw.githubusercontent.com/kaizenraizen/AWSEC2Setup/master/images/step12.png width="" height=""> * Below is an example of the commands I used to connect to the example EC2 instance I created for this tutorial. Breaking down the SSH command snyntax, the -i parameter specifies the key we want to use, and we are logging in as user 'ubuntu' at machine 'c2-54-202-32-201.us-west-2.compute.amazonaws.com' (this is just a domain name amazon gives us for the instance instead of an IP address). <img src=https://raw.githubusercontent.com/kaizenraizen/AWSEC2Setup/master/images/step13.png width="" height=""> * And now you should be logged in to your EC2 instance over SSH!

COMMENTS







keep exploring!

back to all projects