AWS Builder Center
What Really Happens When You Deploy an Application on AWS?

What Really Happens When You Deploy an Application on AWS?

Ever wondered how your code becomes a live website on AWS? Discover the simple steps and AWS services that make it happen.

From localhost to a live website — understanding what actually happens behind an AWS deployment.
You have written your code. Everything works perfectly on your laptop.
You open your browser, type  localhost:3000 , and your application appears.
It feels like the job is done.
But here's an interesting question:
What happens when someone on the other side of the world wants to open your application?
They can't access your localhost. Your application needs a server, an internet connection, and the right configuration to make it publicly accessible.
This is where cloud computing comes in.
As a student exploring AWS and DevOps, I've become interested in understanding what happens behind the scenes when an application moves from a developer's laptop to the cloud.
So, rather than simply explaining AWS services one by one, let's follow the journey of a small application and understand how everything connects.



01. It All Starts With a Simple Question

Where will our application run?
When an application runs on our laptop, it uses our computer's processor, memory, storage, and operating system.
A cloud application needs the same resources.
The difference is that we don't need to own and maintain the physical server ourselves.
With Amazon Elastic Compute Cloud (Amazon EC2), AWS provides virtual computing resources that we can configure and use to run applications.
For this example, imagine we're deploying a simple HTML website using an Ubuntu EC2 instance.
Our basic architecture will look like this:
**User's Browser → Internet → AWS Networking → EC2 Instance → Nginx Web Server **
Nginx will receive HTTP requests and serve our HTML page.
That sounds straightforward, but each component plays an important role.
Beginner-friendly AWS deployment diagram showing how a web application moves from local development




02. Launching an EC2 Instance

Think of Amazon EC2 as a computer running remotely inside AWS infrastructure.
When we launch an instance, AWS asks us to configure a few things.
Amazon Machine Image (AMI)
This determines the operating system and initial software environment. For our demonstration, we'll use Ubuntu Server.
Instance Type
This determines the computing resources available to the instance, such as CPU and memory.
Key Pair
This allows us to authenticate when connecting through SSH, provided we configure the instance for key-based access.
Storage
The instance needs storage for its operating system, web server, and application files.
Networking and Security
We need to decide how the instance connects to the network and which traffic is allowed.
Once the instance reaches the running state, our remote Linux machine is ready.
But there's something important to understand.
A running EC2 instance does not automatically mean our website is accessible.
We still need to configure the networking and application layers.



03. The Networking Layer: How Does AWS Make Our Server Reachable?

Every EC2 instance runs inside an Amazon Virtual Private Cloud (VPC).
A VPC is a logically isolated virtual network where we can deploy AWS resources.
Inside the VPC, we create or select a subnet.
For our simple public web server, the configuration requires:
  • A subnet with a route to an Internet Gateway.
  • A public IPv4 address assigned to the instance.
  • Security rules allowing the required traffic.
  • Network ACL rules that permit the traffic.
Now let's understand the security group.
A security group works like a virtual firewall attached to the EC2 instance.
For this demonstration, we'll configure these inbound rules:
Port 22 — SSH
Used to connect to the Linux server. For security, restrict access to your own trusted public IP address.
Port 80 — HTTP
Allows visitors to access our demonstration website through a browser.
Port 443 — HTTPS
Used for encrypted web traffic when HTTPS has been configured. We won't configure HTTPS in this initial demonstration.
The key takeaway is simple:
Your application might be running perfectly, but incorrect networking or security settings can make it unreachable.
This is why networking is such an important part of cloud engineering.



04. Time to Deploy Our First Website

Now comes the interesting part.
Let's deploy a small HTML page on our Ubuntu EC2 instance.
This is a beginner-friendly demonstration using Nginx, without requiring Docker, Kubernetes, or a complicated application framework.

Step 1: Connect to Your EC2 Instance

After launching your instance, download the private key associated with the key pair you selected.
From a Linux, macOS, or compatible terminal, navigate to the folder containing your key.
Run:
chmod 400 my-key.pem
Now connect:
ssh -i my-key.pem ubuntu@YOUR_PUBLIC_IP
Replace  my-key.pem  with your key filename and  YOUR_PUBLIC_IP  with the instance's actual public IP address.
Once connected, you're working inside your AWS-hosted Linux server.

Step 2: Install Nginx

First, update the package information:
sudo apt update
Install Nginx:
sudo apt install nginx -y
Start Nginx and configure it to start automatically after reboot:
sudo systemctl enable --now nginx
Check its status:
sudo systemctl status nginx
If everything is working correctly, you should see that Nginx is active.

Step 3: Create a Simple Web Application

On a typical Ubuntu Nginx installation, the default website is served from  /var/www/html .
We'll create our own  index.html  file.
Run:
sudo nano /var/www/html/index.html
Replace the existing content with:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, initial-scale=1">
<title>My First AWS Deployment</title>
<style>
body {
font-family: Arial, sans-serif;
background: #0f172a;
color: white;
text-align: center;
padding: 80px 20px;
}

h1 {
color: #ff9900;
}
</style>
</head>
<body>
<h1>Hello from AWS!</h1>
<p>My first website is running on Amazon EC2.</p>
<p>Exploring Cloud Computing and DevOps.</p>
</body>
</html>
Save the file and exit the editor.
In Nano, press  Ctrl + O , then Enter, followed by  Ctrl + X .

Step 4: Verify the Deployment

First, test the website from inside the EC2 instance:
curl http://localhost
If Nginx is serving the page correctly, the HTML content will appear in the terminal.
Now open a browser on your computer and enter:
 http://YOUR_PUBLIC_IP 
If the networking and security configurations are correct, you'll see your webpage displaying:
Hello from AWS!
And that's our first working deployment.
A simple HTML page might not seem impressive, but the infrastructure making it accessible is worth understanding.



05. What Actually Happens When Someone Visits Our Website?

This is where things become fascinating.
Imagine someone opens our website using its public IP address.
What happens behind the scenes?

Step 1 — The Browser Sends a Request

The browser establishes a TCP connection to the server's public IP address on port 80.
It then sends an HTTP request asking for the webpage.

Step 2 — The Request Travels Through the Internet

Routers across the internet forward the traffic towards AWS.
Because we're using an IP address directly, a DNS lookup for a website hostname isn't necessary in this example.

Step 3 — AWS Networking Handles the Traffic

The request reaches the AWS network.
The Internet Gateway enables communication between the internet and our public instance, while the VPC routing and networking configuration determine how the traffic is handled.

Step 4 — Security Rules Are Evaluated

The instance's security group must permit inbound TCP traffic on port 80.
Network ACLs must also allow the necessary inbound and return traffic.
If the required rules don't permit the connection, the request won't successfully reach our web server.

Step 5 — Nginx Processes the Request

Nginx is listening on port 80.
When the HTTP request arrives, Nginx identifies the requested resource and serves our  index.html  file.

Step 6 — The Server Sends a Response

Nginx returns an HTTP response containing the HTML content.
For a successful request, the response will normally include the status:
 HTTP/1.1 200 OK 

Step 7 — The Browser Displays the Website

The browser reads the HTML and CSS, builds the page, and displays it to the visitor.
And there it is.
A webpage that was originally just a file on a server is now accessible through the internet.
That's the real journey behind a basic AWS web deployment.



06. But Is Our Website Production-Ready?

Not yet.
Our application works, but a working demonstration and a production-ready application are two different things.
Let's understand what's missing.

Security

Our website currently uses HTTP, which doesn't encrypt the connection.
A production website should normally use HTTPS with a valid TLS certificate.

High Availability

Our website runs on one EC2 instance.
If that instance fails, the website becomes unavailable.
A more resilient architecture might use multiple instances across Availability Zones.

Scalability

What happens if thousands of users suddenly visit our website?
One small instance might struggle to handle the traffic.
Amazon EC2 Auto Scaling and Elastic Load Balancing can help support changing workloads.

Monitoring

How do we know if our server is unhealthy or consuming too much CPU?
Amazon CloudWatch provides monitoring and observability capabilities.

Automation

What happens when we need to deploy new application changes every day?
Manually editing files on a server isn't an ideal long-term solution.
This is where DevOps practices become especially valuable.



07. Where Does DevOps Enter the Picture?

Imagine this scenario.
You make a small change to your website.
You connect to EC2, update the file, check the application, and repeat the same steps every time.
For a small experiment, that's manageable.
But imagine maintaining dozens of applications with multiple developers deploying changes frequently.
Manual processes become difficult to manage.
DevOps focuses on improving how software is built, tested, deployed, operated, and continuously improved.
One important practice is Continuous Integration and Continuous Delivery (CI/CD).
A simple automated workflow could look like this:
Developer → GitHub → CI/CD Pipeline → Automated Tests → AWS Deployment → Monitoring
Infrastructure as Code tools such as Terraform can also help us define and provision cloud resources through configuration files.
Instead of repeatedly creating infrastructure manually, we can manage it in a more consistent and repeatable way.
This is what makes DevOps interesting to me.
It's not just about learning Docker, Kubernetes, Terraform, or Jenkins individually.
It's about understanding how these tools and practices solve real engineering problems.



08. One Important Lesson: Cloud Resources Can Cost Money

Before experimenting with AWS, it's important to understand cloud billing.
AWS offers Free Tier benefits for eligible accounts, but that doesn't mean every service or resource is always free.
For example, charges can depend on:
  • EC2 instance type and running time.
  • Public IPv4 address usage.
  • EBS storage volumes.
  • Data transfer.
  • Your account's current Free Tier eligibility.
Before creating resources, review the current AWS pricing and Free Tier terms.
It's also a good practice to configure AWS Budgets and billing alerts.
After completing a lab, terminate resources you no longer need and check for remaining chargeable resources.
Learning how to control cloud costs is part of becoming a responsible cloud engineer.



09. What Did We Actually Learn?

By following one simple deployment, we've connected several important concepts.
Compute: Amazon EC2 provides the virtual machine where our website runs.
Networking: The VPC, subnet, routing, and Internet Gateway help make the instance reachable.
Security: Security groups and network ACLs control permitted network traffic.
Web Serving: Nginx receives HTTP requests and delivers the webpage.
Reliability: Monitoring, scaling, and redundancy become important as applications grow.
DevOps: Automation and continuous delivery help make deployments more consistent and maintainable.
The biggest lesson is that cloud deployment isn't just about clicking a launch button.
It's about understanding how different layers work together.



10. Final Thoughts: Think Beyond the Deploy Button

When we first start learning AWS, it's easy to focus on individual services and their features.
But real understanding begins when we connect those services to actual problems.
A server might be running while its application is unavailable.
A website might work locally but fail because of a security group rule.
A deployment might succeed but still need improvements in security, monitoring, reliability, and cost management.
These are the kinds of challenges that make cloud engineering interesting.
As I continue exploring AWS and DevOps, my goal is to move beyond simply following tutorials.
I want to understand why systems work, what causes them to fail, and how to build better solutions.
And that's what makes learning cloud computing exciting.
One question before you leave:
If your EC2 instance is running and Nginx is active, but your website still won't open in the browser, what would you check first?
I'd love to hear how you'd approach troubleshooting it.


Thanks for reading! This article is part of my learning journey in AWS, Cloud Computing, and DevOps. Looking forward to sharing more practical experiments and technical insights.
#AWS #AmazonEC2 #DevOps #CloudComputing #Networking
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article