AWS-Logo_White-Color
1.
Introduction
2.
Preparation
3.
Configuration
3.1
Create VPC
3.2
Create Security Group-EC2
3.3
Connect EC2
3.4
Create ECR&ECS cluster
3.5
Push images in ECR repository
3.6
Create Task Definition
3.7
Create target group & ALB
3.8
Create Service in Cluster
3.9
Create record Route 53
4.
Clean up resources
More
AWS Study Group
English
Clear History
Workshop
Cloud Journey
Last Updated
6/10/2024
Team
Gia Hưng
Thanh Hiệp
>
Configuration
> Connect EC2
Connect EC2
Connect SSH to EC2
Install docker & git
Follows Command line:
sudo yum update
sudo yum install git -y
sudo yum install docker -y
Check version
Create Dockerfile, build Docker images, Docker container.
Git clone source code:
https://github.com/hs-nguyen/Host-a-Static-Web-App-on-AWS-with-Docker-and-AWS-ECS.git
CLI:
“Cd Host-a-Static-Web-App-on-AWS-with-Docker-and-AWS-ECS”
Create Dockerfile
FROM nginx:1.25.3
COPY ./ /usr/share/nginx/html
EXPOSE 80
CMD [“nginx”, “-g”, “daemon off;”]
Check
Build Docker images & Docker container
Follows CLI
CLI:
docker build -t web-app .
(Build Docker images)
CLI:
docker run -d –name web-app -p 8080:80 web-app
(Run Docker container)
CLI:
docker ps-a
(Check status container)
Check
Custom inbound rules for security group for EC2
Add inbound rules:
Types:
Custom TCP
Protocol:
TCP
Port range:
8080
Source:
Anywhere
Access to Website through IP public EC2