Skip to main content
Join the Agentforce Hackathon on Nov. 18-19 to compete for a $20,000 Grand Prize. Sign up now. Terms apply.

Get To Know Amazon Elastic Compute Cloud

Learning Objectives

After completing this unit, you’ll be able to:

  • Describe how Amazon EC2 functions.
  • Explain the use of Amazon Machine Images (AMIs).
  • Explain the relationship between Amazon EC2 and AMIs.

To power your cat photo application, you consider using Amazon EC2 as the compute layer.

What Is Amazon EC2?

The Amazon EC2 icon, depicting three EC2 instances

Amazon EC2 is a web service that provides secure, resizable compute capacity in the cloud. It allows you to provision virtual servers called EC2 instances. Although AWS uses the phrase “web service” to describe it, it doesn’t mean that you are limited to running just web servers on your EC2 instances. 

You can create and manage these instances through the AWS Management Console, the AWS Command Line Interface (CLI), AWS Software Development Kits (SDKs), or through automation tools and infrastructure orchestration services.

In order to create an EC2 instance, you need to define:

  • Hardware specifications, like CPU, memory, network, and storage.
  • Logical configurations, like networking location, firewall rules, authentication, and the operating system of your choice.

When launching an EC2 instance, the first setting you configure is which operating system you want by selecting an Amazon Machine Image (AMI).

What Is an AMI?

In the traditional infrastructure world, the process of spinning up a server consists of installing an operating system from installation disks, installation drives, or installation wizards over the network. In the AWS Cloud, this operating system installation is no longer your responsibility, and is instead built into the AMI that you choose.

Not only does an AMI let you configure which operating system you want, you can also select storage mappings, the architecture type (such as 32-bit, 64-bit, or 64-bit ARM), and additional software installed.

What Is the Relationship Between AMIs and EC2 Instances?

EC2 instances are live instantiations of what is defined in an AMI, much like a cake is a live instantiation of a cake recipe. If you are familiar with software development, you can also see this kind of relationship between a Class and an Object.

A Class is something you model and define, while an object is something you interact with. In this case, the AMI is how you model and define your instance, while the EC2 instance is the entity you interact with, where you can install your web server, and serve your content to users.

When you launch a new instance, AWS allocates a virtual machine that runs on a hypervisor. Then the AMI you selected is copied to the root device volume, which contains the image used to boot the volume. In the end, you get a server you can connect to and install packages and any additional software. In this case, you install a web server along with the properly configured source code of your cat photo app.

When you create an instance for your cat photo application, you choose an AMI. You get a virtual machine. Then the AMI is copied to the root volume.

One advantage of using AMIs is that they are reusable. Consider the scenario where you launch an EC2 instance for your cat photo application. You might choose a Linux-based AMI and configure the HTTP server, application packages, and any additional software you may need to run your application. 

If you wanted to create a second EC2 instance with the same configurations, how can you easily do that? One option is to go through the entire instance creation and configuration process and try to match your settings to the first instance. However, this is time consuming and leaves room for human error. The second, better option, is to create an AMI from your running instance and use this AMI to start a new instance. This way, your new instance will have all the same configurations as your current instance, because the configurations set in the AMIs are the same.

One AMI is used to launch EC2 instance #1, that instance is used to create AMI #2, which is used to launch EC2 instance #2.

Where Can You Find AMIs?

You can select an AMI from the following categories.

  • Quick Start AMIs that are premade by AWS and allow you to get started quickly.
  • AWS Marketplace AMIs that provide popular open source and commercial software from third-party vendors.
  • My AMIs that are created from your EC2 instances.
  • Community AMIs that are provided by the AWS user community.
  • Build your own custom image with EC2 Image Builder.

Screenshot of the console. You can choose from four categories: Quick Start, My AMIs, AWS Marketplace, and Community AMIs. This is highlighted by a red box. Quick Start is selected. Each AMI has an AMI-ID. The AMI-ID for Amazon Linux is highlighted by another red box.

Each AMI in the AWS Management Console has an AMI ID, which is prefixed by “ami-”, followed by a random hash of numbers and letters. These IDs are unique to each AWS region.

Wrap Up

You just learned the difference between an AMI and an EC2 instance, and the relationship between them. In the next unit, you dive deeper into Amazon EC2 and learn about the different types of EC2 instances you can use for your cat photo application.

Resources

Teilen Sie Ihr Trailhead-Feedback über die Salesforce-Hilfe.

Wir würden uns sehr freuen, von Ihren Erfahrungen mit Trailhead zu hören: Sie können jetzt jederzeit über die Salesforce-Hilfe auf das neue Feedback-Formular zugreifen.

Weitere Infos Weiter zu "Feedback teilen"