Zum Hauptinhalt springen
Sichere ProgrammierungI'm an AI agent. I read the agent-economy job boards' own numbers.(05.10.2026 um 03:41 Uhr)
••••
Sichere ProgrammierungYour ops dashboard does not need a frontend framework(05.10.2026 um 03:47 Uhr)
•
Sichere ProgrammierungThree pieces, zero readers: what I got wrong about publishing(05.10.2026 um 03:47 Uhr)
•
Sichere ProgrammierungProofDesk: A contact review is only as current as its evidence(05.10.2026 um 03:49 Uhr)
•
AI & KI NachrichtenAI Agents - Tool Calling And Its Types(05.10.2026 um 03:49 Uhr)
•
Sichere ProgrammierungSTAGE LADDER - A Private, Offline Speaking Coach Built for a Friend(05.10.2026 um 03:51 Uhr)
••
Sichere ProgrammierungI'm an AI agent. I read the agent-economy job boards' own numbers.(05.10.2026 um 03:41 Uhr)
••••
Sichere ProgrammierungYour ops dashboard does not need a frontend framework(05.10.2026 um 03:47 Uhr)
•
Sichere ProgrammierungThree pieces, zero readers: what I got wrong about publishing(05.10.2026 um 03:47 Uhr)
•
Sichere ProgrammierungProofDesk: A contact review is only as current as its evidence(05.10.2026 um 03:49 Uhr)
•
AI & KI NachrichtenAI Agents - Tool Calling And Its Types(05.10.2026 um 03:49 Uhr)
•
Sichere ProgrammierungSTAGE LADDER - A Private, Offline Speaking Coach Built for a Friend(05.10.2026 um 03:51 Uhr)
••
Intelligence View
⚡ tsecurity.de Intelligence

Deploying a Secure & Scalable Web App on AWS EC2 (No ECS, No Beanstalk!)

Starting the Tutorial In this tutorial, we’ll go step-by-step through deploying a Dockerized web application on AWS EC2 using only EC2 services — no Elastic Bea…

Beitrag
0
Seite
0
↗ Quelle (dev.to)
Social ReaktionenReagiere als Erste:r — dein Feedback zählt!

Starting the Tutorial



In this tutorial, we’ll go step-by-step through deploying a Dockerized web application on AWS EC2 using only EC2 services — no Elastic Beanstalk, no ECS, no shortcuts.



By the end, you’ll have:




  • A launch template that auto-installs Docker and deploys your app.

  • An Auto Scaling Group for high availability.

  • A custom domain pointing to your EC2 instance.



Prerequisites

Before we start, make sure you have:




  • An AWS account

  • Access to ChatGPT (optional, but great for debugging along the way!)

  • IAM roles with permissions for EC2, ECR, SSM, and Auto Scaling

  • Basic knowledge of GitHub (to clone your project repo)

  • Docker installed on your local machine






Part 1 – Configuring EC2 Using a Launch Template



We’ll start by setting up an EC2 Launch Template — this defines how each instance should be created, configured, and secured.

a - On your AWS Management Console, search for “Launch Templates”.





b - We will then be redirected to this page and proceed to click on Create Launch Template





You’ll now see a form to define the template’s details. Let’s fill it out together 👇



Basic Configuration




  1. Template name: cloud-tutorial






  1. Application and OS Image (AMI):




  • Ubuntu Server 24.04 LTS (64-bit x86)






  1. Instance type: t3.small






  1. Network settings:




  • Create a new security group






  • Allow port 80 (HTTP) and port 443 (HTTPS)

  • Disable SSH access — we’ll use SSM Session Manager for secure logins.






  1. Storage: 20 GB (change from the default 8 GB)


  2. Monitoring: Enable CloudWatch monitoring




This helps with debugging and tracking CPU, disk I/O, and network usage.






  1. IAM instance profile:





Choose your IAM role (e.g., LabRole if you’re using AWS Academy).



Finally, click Create launch template ✅



You should now see your new template listed.








Part 2 - Setting Up Auto Scaling for High Availability



Next, we’ll configure an Auto Scaling Group (ASG) to automatically manage EC2 instances.




  1. Go to EC2 → Auto Scaling Groups → Create Auto Scaling Group






  1. Name it ASG-cloud-tutorial

  2. Select your launch template (cloud-tutorial)

  3. Choose two Availability Zones and their subnets for high availability.(In the network section)






  • Leave the distribution as “Balanced best effort”.

  • Integrating Load Balancing
    In the “Load Balancing” section:


    • Enable Elastic Load Balancing (ALB).











* Turn on ELB health checks, so EC2 Auto Scaling can replace unhealthy instances.(Then configure scaling:Minimum capacity: 1,Desired capacity: 1,Maximum capacity: 3,Target tracking policy: Average CPU utilization at 50%.)
This ensures your app scales up under load and back down when idle — saving costs while staying responsive.






Once done, click Create Auto Scaling Group ✅

Your configuration should look like this:

Part a -





Part b -





Part c -








Part 3 – Deploying the Application



Now that your infrastructure is ready, let’s deploy a simple app.

Project Structure

Your app repository will look like this:








Deployment steps




  1. Clone your repo to your local machine:




git clone https://github.com/AbdielJonathan007/cloud-tutorial
cd cloud-tutorial








  1. Use Docker Buildx for multi-platform builds (for M1/M2 Mac compatibility and when we upload to EC2 instances later):






  1. Create an ECR repository for each component:


    • backend

    • frontend

    • nginx
      At Amazon search bar look for : ECR repository
      Choose:
      Visibility: Private
      Repository name: hello-world-app
      Leave encryption and scanning default
      Click Create repository
      After creating you get a url like this:339712882354.dkr.ecr.us-east-1.amazonaws.com/hello-world-app


    • After creating the repository we will need the following information








  • Which in our case we are using the canvas lab to access the information would be under AWS details then clicking on AWS CLI , then we fill out that informationB
    Then we run this command to Retrieve an authentication token and authenticate your Docker client to your registry. Use the AWS CLI:


    • Then we run this command









aws ecr get-login-password --region us-east-1 | \
docker login --username AWS --password-stdin 339712882354.dkr.ecr.us-east-1.amazonaws.com









We will need to push 3 Docker images




  • frontend






  • backend






  • nginx








Part 4 - Automating Deployment via Launch Template



Now we’ll make sure new EC2 instances automatically install Docker and run the app.

Steps:




  1. Go to EC2 → Launch Templates → Actions → Create new version

  2. Scroll to Advanced details → User data

  3. Paste this script:




#!/bin/bash
apt update -y
apt install -y docker.io unzip curl
systemctl enable docker --now
aws ecr get-login-password --region us-east-1 | \
docker login --username AWS --password-stdin 339712882354.dkr.ecr.us-east-1.amazonaws.com

docker pull 339712882354.dkr.ecr.us-east-1.amazonaws.com/backend:latest
docker pull 339712882354.dkr.ecr.us-east-1.amazonaws.com/frontend:latest
docker pull 339712882354.dkr.ecr.us-east-1.amazonaws.com/nginx:latest

docker network create myapp-network
docker run -d --name backend --network myapp-network -p 5000:5000 backend:latest
docker run -d --name frontend --network myapp-network -p 3000:3000 frontend:latest
docker run -d --name nginx --network myapp-network -p 80:80 nginx:latest







4 - Create the new version and attach it to your Auto Scaling Group (ASG).

Now, whenever ASG launches a new EC2 instance, it’ll run this script automatically. 💪

We should see something like this :








Part 5 - Connecting Your Domain (Using Name.com Only)



Now that our app is up and running on EC2, let’s make it accessible through a custom domain instead of the public IP.



We’ll be using a domain from Name.com, and we’ll connect it directly using DNS “A” records — no Route 53 needed.



Step 1: Get Your EC2 Public IP



1️⃣ Open the AWS Management Console → EC2 → Instances.

2️⃣ Select the instance that’s running your app.

3️⃣ Copy the Public IPv4 address (for example, 3.90.248.104).



Step 2: Add DNS Records on Name.com



1️⃣ Log in to your Name.com

account.

2️⃣ Go to My Domains → abdielcloud.live → Manage DNS.

3️⃣ Under DNS Records, add two A records:





Click Save Changes when you’re done.



Once propagation finishes, navigating to

http://abdielcloud.live

(or http://www.abdielcloud.live)

should open your frontend running on the EC2 instance 🎉



Thank you for reading thus far!

🔍 CTI & Forensik

Cyber Threat Intelligence & Forensik

ATT&CK-Navigator · IoC-Radar · Exploit-Belege
IoC Intelligence
3 Indikatoren · Defanged · STIX 2.1
3[.]90[.]248[.]104abdielcloud[.]livewww[.]abdielcloud[.]live
CTI Threat Relationship Graph
Akteure · Techniken · Beziehungen
4 Knoten · 3 Relationen
CVE / Incident Threat Actor Software MITRE ATT&CK CWE Weakness IoC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Deploying a Secure & Scalable Web App on AWS EC2 (No ECS, No Beanstalk!)

Thematisch verwandte Begriffe: Deploying, Secure, Scalable, Beanstalk · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
Nächster Beitrag