Launch an EC2 Instance
June 2016 · 4 minute read
1. Log into the console
2. Ensure you’re in the closes region
3. Open EC2 Section
4. Launch Instance
5. Choose you AMI (VM) - Probably the Amazon Linux AMI
Different Virtual Machine Types are available: (PV) Paravirtual, (HVM) Hardware Virtual Machine
6. Choose Instance Type i.e. t2 Micro
7. Configure Instance Details
- Request spot instances and configure them or use on-demand instances
- Network uses default VPC in all regions
- Choose your subnet (1 subnet= 1 availability zone)
- Auto-assign Public IP will use the subset provided by default
- Choose IAM role (previously set up)
- Choose shutdown behaviour (either stop or terminate)
- Enable termination protection (Not enabled by default)
- Monitoring (Can enable detailed monitoring by CloudWatch at a cost - basic is enabled by default)
- Tenancy - determines whether the instance is run on a shared or dedicated host
- Advanced Details: User Data - (Not compulsory) This is where you can opt to automatically run scripts on provisioning. An example to target the path and run updates would be:
#!bash/bin
yum update -y
8. Add Storage - EBS (Elastic Block Storage) Volume Type is Root, meaning that it is where the operating system is installed.
Delete on termination is selected by default which will also delete the EBS volume.
The root volume (where the O/S is installed) is not encrypted by default and that cannot be changed. Additional volumes, however, can be encrypted
9. Tag Instances - Always a key-val pair. Can have up to 10 keys per EC2, can be useful later on for resource tagging/ billing purposes and seeing what is allocated to which resources
10. Configure Security Groups - kind of like a virtual firewall.
Create a new security group
Create rules for SSH and HTTP (automatically detects port range) & select a source option (port from anywhere/my IP/Custom IP)
11. Review and Launch - allows you to Select an existing key pair or create a new one
- Create a New key pair
- Give it an appropriate name and download your private key
- Launch instances
12. View instances - can take up about a minute to finish launching
13. Open your terminal
- Open terminal
- Navigate to your download key that you downloaded when launching your instance
- Change the permissions for your private key $ chmod 600 key pair.pem
- Connect into your Amazon Linus AMI $ ssh c2-user@
-i Keypair.pem - Add authenticity to list of known hosts
- Once connected, elevate privileges to root $ sudo su
- Run an update (if you haven’t set your EC2 to automatically do this) $ yum update -y
14. If you have trouble terminating your instance, it’s because you will need to disable termination protection on your instance.
Create a Windows EC2 Instance with a RAID Group
1. Log into EC2
2. Security Groups
3. Select a security group and under ‘Inbound Rules’ - Add Remote Desktop Protocol (RPD)
4. Back on the dash board, Launch a new Instance
5. Choose Machine Image AMI - Microsoft Windows Server 2012 R2 Base
6. Use a t2 Micro
7. Configure Instance Details
8. Add Storage with 4 additional ABS Volumes which are all SSD and 8GB in size
9. Tag the Instance
10. Add the instance to the security group above which was configured with Inbound RDP
11. Launch Instance with a new key pair and download your private key - Windows VMs typically take longer than Linux to initialise on Cloud infrastructure, including AWS.
12. Log into the Windows VM using RDP, Username: Administrator, Password: comes from AWS platform
- Select the instance
- Under actions, click “Get Windows Password”
- Upload your private key to the pop up window
- Decrypt password
13. To access the windows instance from a mac, Open Microsoft Remote Desktop (downloadable from the app store)
- Create a new connection with the connection name (Pulbic IP), username and password
- Click on connect
- Click continue on the “Verify Certificate” pop-up (Can take a while to establish the session)
14. Now in the Windows session, you can use the windows desktop
- Click on Start => “Disk Management”
- You can see Disk 1-4 which represent the seperate EBS volumes previously created. Right click and delete all of them.
- Right click on the first unallocated volume and slept “Create New Striped Volume” which is effectively a RAID-0
- Follow the set up wizard and add all available disks
- Assign the new volume to drive “D” and select “Perform a quick format”