What is Amazon Elastic Compute Cloud in AWS?
Amazon Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides secure, resizable compute capacity in the cloud. It is designed to make webscale computing easier for developers. The Amazon EC2 simple web service interface allows customers to obtain and configure capacity with minimal friction. It provides them with complete control of the computing resources and run on Amazon’s proven computing environment.
Amazon EC2 reduces the time required to obtain and boot new server instances (called Amazon EC2 instances) to minutes, allowing customers to quickly scale capacity, both up and down, as the computing requirements change. Amazon EC2 changes the economics of computing by allowing to pay only for capacity that actually use. Amazon EC2 provides developers and system administrators the tools to build failure resilient applications and isolate themselves from common failure scenarios.
How do I create an Amazon Elastic Compute Cloud instance?
- Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
- Choose Launch Instance.
- Choose an Amazon Machine Image (AMI), find an Amazon Linux AMI at the top of the list and choose Select.
- Choose an Instance Type, choose Next: Configure Instance Details.
- Configure Instance Details, provide the following information:
- For Network, choose the entry for the same VPC that you noted when you created your EFS file system in Step 1: Create Your Amazon EFS File System.
- For Subnet, choose a default subnet in any Availability Zone.
- For File systems, make sure that the EFS file system that you created in Step 1: Create Your Amazon EFS File System is selected. The path shown next to the file system ID is the mount point that the EC2 instance will use, which you can change. Choose Add to user data to mount the file system when the EC2 is launched.
- Under Advanced Details, confirm that the user data is present in User data.
- Choose Next: Add Storage.
- Choose Next: Add Tags.
- Name your instance and choose Next: Configure Security Group.
- Configure Security Group, set Assign a security group to Select an existing security group. Choose the default security group to make sure that it can access your EFS file system.You can’t access your EC2 instance by Secure Shell (SSH) using this security group. SSH access isn’t required for this exercise. To add access by SSH later, you can edit the default security and add a rule to allow SSH. Or you can create a new security group that allows SSH. You can use the following settings to add SSH access:
- Type: SSH
- Protocol: TCP
- Port Range: 22
- Source: Anywhere 0.0.0.0/0
- Choose Review and Launch.
- Choose Launch.
- Select the check box for the key pair that you created, and then choose Launch Instances.
- In the Amazon EC2 console, select the instance, and then choose Connect.
- In the Connect To Your Instance dialog box, choose Get Password (it will take a few minutes after the instance is launched before the password is available).
- Choose Browse and navigate to the private key file you created when you launched the instance. Select the file and choose Open to copy the entire contents of the file into the Contents field.
- Choose Decrypt Password. The console displays the default administrator password for the instance in the Connect To Your Instance dialog box, replacing the link to Get Password shown previously with the actual password.
- Record the default administrator password, or copy it to the clipboard. You need this password to connect to the instance.
- Choose Download Remote Desktop File. Your browser prompts you to either open or save the .rdp file.
- You may get a warning that the publisher of the remote connection is unknown. You can continue to connect to your instance.
- When prompted, log in to the instance, using the administrator account for the operating system Enter the password that you recorded or copied previously.
- To verify the identity of the remote computer, or simply choose ok
- Choose Yes in the Remote Desktop Connection window to connect to your instance.
Using an AMI
The following diagram summarizes the AMI lifecycle. After you create and register an AMI, you can use it to launch new instances. (You can also launch instances from an AMI if the AMI owner grants you launch permissions.) You can copy an AMI within the same Region or to different Regions. When you no longer require an AMI, you can deregister it.
After you launch an instance from an AMI, you can connect to it. When you are connected to an instance, you can use it just like you use any other server. For information about launching, connecting, and using your instance, see Amazon EC2 instances.
Creating your own AMI
You can launch an instance from an existing AMI, customize the instance, and then save this updated configuration as a custom AMI. Instances launched from this new custom AMI include the customizations that you made when you created the AMI.
The root storage device of the instance determines the process you follow to create an AMI. The root volume of an instance is either an Amazon EBS volume or an instance store volume. For more information about the root device volume, see Amazon EC2 root device volume.
- To create an Amazon EBS-backed AMI, see Creating an Amazon EBS-backed Linux AMI.
- To create an instance store-backed AMI, see Creating an instance store-backed Linux AMI.
To help categorize and manage your AMIs, you can assign custom tags to them. For more information, see Tagging your Amazon EC2 resources.
Buying, sharing, and selling AMIs
After you create an AMI, you can keep it private so that only you can use it, or you can share it with a specified list of AWS accounts. You can also make your custom AMI public so that the community can use it. Building a safe, secure, usable AMI for public consumption is a fairly straightforward process, if you follow a few simple guidelines. For information about how to create and use shared AMIs, see Shared AMIs.
You can purchase AMIs from a third party, including AMIs that come with service contracts from organizations such as Red Hat. You can also create an AMI and sell it to other Amazon EC2 users. For more information about buying or selling AMIs, see Paid AMIs.
Deregistering your AMI
You can deregister an AMI when you have finished with it. After you deregister an AMI, it can’t be used to launch new instances. Existing instances launched from the AMI are not affected. For more information, see Deregistering your Linux AMI.
Amazon Linux 2 and Amazon Linux AMI
Amazon Linux 2 and the Amazon Linux AMI are supported and maintained Linux images provided by AWS. The following are some of the features of Amazon Linux 2 and Amazon Linux AMI:
- A stable, secure, and high-performance execution environment for applications running on Amazon EC2.
- Provided at no additional charge to Amazon EC2 users.
- Repository access to multiple versions of MySQL, PostgreSQL, Python, Ruby, Tomcat, and many more common packages.
- Updated on a regular basis to include the latest components, and these updates are also made available in the yum repositories for installation on running instances.
- Includes packages that enable easy integration with AWS services, such as the AWS CLI, Amazon EC2 API and AMI tools, the Boto library for Python, and the Elastic Load Balancing tools.