Skip to content

Create an EC2 instance in a public or private subnet

Marc Grossouvre edited this page Oct 9, 2019 · 12 revisions

An EC2 instance is a virtual server in the Elastic Compute Cloud. Creating an EC2 Instance means choosing some hardware and some OS to run on it. For hardware, we choose among presed configurations called Instance Types. For OS, we choose among predefined images called AMI for Amazon Machine Image. An EC2 instance has to be in a subnet.

simple image : Amazon Linux 2 AMI (HVM), SSD Volume Type. It is based on a Amazon specific linux distribution. simple instance type : t2.micro

###Configure instance details page.

This is where we choose the instance location in the VPC.

  • Network : choose relevant VPC
  • Subnet : choose relevant subnet
  • Auto-assign Public IP : Enable when in a public subnet, disable in a private subnet.
  • Network interface : allows using a reserved IP for a web server for example
  • Advanced details, User data : paste here a script tha will be executed at creation time

Configure security group:

  • give it a name
  • keep ssh port open from any source
  • open "All ICMP - IPv4" from any source so that machine can be pinged
  • open HTTP, HTTPs or any required stuff

Path:

  • -> EC2 Dashboard
  • -> Launch Instance
  • -> choose an AMI -> Select
  • -> choose an instance type -> Next: Configure instance details
  • -> set parameters -> Next : Add Storage
  • -> choose hard drive capacity -> Next : Add tag
  • -> set a Name tag -> Next : Configure Security Group
  • -> set parameters -> Review and Launch
  • -> Launch
  • -> Choose a pair
  • -> Launch Instances
  • -> View Instances