What is Amazon EC2?
In simple terms, Amazon EC2 is a service that allows us to run virtual servers in the cloud. These virtual servers are called instances.
Think about a traditional server in a data center. It has computing resources such as CPU, memory, storage, and an operating system.
An EC2 instance provides a similar environment, but with the flexibility of AWS. Instead of purchasing physical hardware, we can launch an instance whenever we need it and choose the configuration that best fits our requirements.
How does an EC2 instance work?
When launching an EC2 instance, we need to define a few basic configurations:
Amazon Machine Image (AMI): A template used to create an instance, including the operating system and initial configurations.
- Instance Type: Defines the computing resources available, such as CPU and memory.
- Storage: Provides disk space for the operating system, applications, and data.
- Key Pair: Used to authenticate when connecting to supported instances.
- Security Group: Controls inbound and outbound network traffic to the instance.
These configurations help determine how our virtual server will operate and communicate with other resources.
A quick look at the AWS Console
The AWS Management Console provides a graphical interface where we can create, configure, monitor, and manage EC2 instances.
For beginners, it's a great place to explore the service and understand how its different configurations fit together.
Getting familiar with EC2 through the AWS CLI
Since I'm also interested in automation and infrastructure, I wanted to explore how we can interact with EC2 directly from the command line.
First, let's check our AWS CLI configuration:
This command displays the configuration currently being used by the AWS CLI, including the credentials source, default region, and output format. It does not reveal your secret access key.
Now, let's list the EC2 instances in our account:
aws ec2 describe-instances
\--query "Reservations\[].Instances\[].\[InstanceId,State.Name,InstanceType]"
\--output table
This command retrieves information about our EC2 instances, including their IDs, current states, and instance types.
For example, we might see instances with states such as:
- running: The instance is running.
- stopped: The instance is stopped.
- pending: The instance is starting.
- terminated: The instance has been terminated.
It's a simple example, but it shows how we can retrieve infrastructure information directly from the terminal.
Connecting EC2 to what we see in the NOC
Coming from a NOC background, I find EC2 particularly interesting because it brings something familiar into the cloud environment: servers that need to be monitored and managed.
An EC2 instance has resources such as CPU, memory, storage, and network interfaces. Understanding these components is important when investigating performance issues, resource utilization, and availability.
This is also where other AWS services, such as Amazon CloudWatch, become relevant for monitoring and observability.
Final thoughts
Amazon EC2 is one of the best starting points for understanding how computing resources work in AWS.
We've seen that an instance is essentially a virtual server, learned about some of its main configurations, and explored how to retrieve information using the AWS CLI.
There's still a lot to learn, but understanding the basics is already a great step forward.
One step at a time, one concept at a time.
Loading article