General steps for launching an EC2 instance and doing SSH

We can launch an EC2 instance by following these steps:

  1. Go to the EC2 dashboard.
  2. Click on Instances from the left sidebar.
  3. Click on the Launch Instance button at the top of the page.
  4. Select Amazon Linux 2 AMI (HVM), SSD Volume Type - ami-00dc79254d0461090 (64-bit x86).
  5. On the Choose an Instance Type page, set Type to t2.micro and click Next: Configure Instance Details.
  1. Within the Configure Instance Details page, either choose a custom VPC or the default one. You can also add user data that will be executed during the launch. 
  2. We can use the default configuration in the Add Storage page. Click Next: Add Tags.
  3. On the Add Tags page, add a tag with Key set to Name. For Value, enter a meaningful name. Click on Next: Configure Security Group.
Tags are not mandatory, but a tag with Key set to Name can help us identify our EC2 instances easily from the list of EC2 instances in the EC2 dashboard.
  1. On the Configure Security Group page, either choose an existing security group or create a new security group. Exact permission rules for the security group are provided under the respective recipes.
  2. On the Review Instance Launch page, review the configuration and click on Launch
  3. We can use an existing key pair and click on Launch Instances, or we can create a new key pair and launch an instance, as follows:
    1. Select the Create a new key pair option.
    2. Click on Download Key Pair to download the key. Save the key safely. If you are using a Unix or Mac system, then change its file permission (chmod) to 400.
    3. Click on Launch Instances.
  4. Click on View Instances and wait until our instance's Instance State is changed to running and the Status Checks field has no errors.
  5. Click on our instance and check the summary. 
  6. We can SSH into our EC2 instance with the following command on a Mac or Linux machine. The exact command or steps may differ between operating systems: 
    ssh -i aws-sec-cb-demo-kp.pem ec2-user@54.145.102.218

    Here, aws-sec-cb-demo-kp.pem is the key pair's private key file we downloaded in step 11.

    ..................Content has been hidden....................

    You can't read the all page of ebook, please click here login for view all page.
    Reset
    3.133.144.59