Introduction

At the moment I am preparing for new certifications due to a job change. In my new position, I should be able to show more proven cloud skills. In fact, this means that I am currently preparing for the AWS Certified Cloud Practitioner exam. As part of this process, I studied the AWS EC2 Cloud service.

In this tutorial you will learn how to deploy an EC2 instance (i.e. a VM) in AWS, test its functionality and then terminate it again (≠ shutdown).

Table of Content:

  1. Introduction
  2. Prerequisites
  3. EC2 Instance provisioning based on an AMI (Amazon Machine Image)
  4. EC2 Instance function test
  5. EC2 Instance deprovisioning
  6. Conclusion


Prerequisites

  • Active AWS - Account


EC2 Instance provisioning based on an AMI (Amazon Machine Image)

  • Log in into the AWS - Console

Link: https://aws.amazon.com/en/console/

  • Solve the security check question.
  • Enter your password.
  • Look for the "Launch a virtual machine" option.
  • Select the "Amazon Linux 2 AMI (HVM), SSD Volume Type".
  • Choose the free "t2.micro" type instance and go ahead by clicking "Next: Configure Instance Details".
  • Set the "Auto-assign Public IP" feature to "Enable".
  • Add the following "User data" commands (1)....
#!/bin/bash
yum install httpd -y
service httpd start
  • and click on "Next: Add Storage"
  • Leave the settings as preselected.
  • Click on "Next: Add Tags"
  • Click on "Next: Configure Security Group"
  • Add an HTTP rule (1) to allow all web-based connection requests.
  • Click on "Review an Launch"
  • Click on "Launch"
  • Select "Proceed without a key pair" (1) and activate the acknowledge check box (2).
  • Go ahead by clicking in "Launch Instances" (3).
  • Follow the launching process by clicking on the link provided.


EC2 Instance function test

  • Click on "open address"

The test page will be displayed in your default browser.



EC2 Instance deprovisioning

  • Return to the EC2 instance info page.
  • Click on the "Instance state" drop down menue and select "Terminate instance".
  • Click on "Terminate"

You should now receive a message that the instance has been successfully terminated.



Conclusion

In this tutorial, you learned how to provision an EC2 instance ( a virtual machine) in AWS, install a web server, and access the default web page of this web server. After that, you learned how to terminate the instance so that no unnecessary costs are generated.

Of course, this task was not really very challenging so far. However, it was very helpful for a first understanding of how to provide resources in AWS. For passing the AWS Cloud Practitioner certificate in any case already sufficient.

Stay tuned for my next tutorials for AWS and the Cloud Practitioner certificate.