- Create VPC with one public and one private subnet
- Configure routes for private subnet and public subnet
- Create 3 security groups - for EC2 Container Instances to be hit by loadbalancer, a security group from the application load balancer, another for the ECS Cluster
- Create a target group with target type as IP with default health check settings.
- Create application load balancer in the above in the VPC with the preconfigured target groups, security groups.
- Create an ECS cluster with the above configurations
- Launch 2 instances (here, one t2.micro, one t2.large) with ECS optimized Amazon AMI 2 and configure the
ecs.configfile to point to the above created ECS cluster. - Build the docker container image in one of the EC2 instances and push it to the ECR.
- Create task definitions with the above docker conatiner image.
- Create a service with 2 tasks of
replicatype inEC2 launch typeand add the above created ALB and target group to its configuration
Last active
February 29, 2020 08:35
-
-
Save adityaprakash-bobby/eff11b3201d759071d5b006a0f4b2271 to your computer and use it in GitHub Desktop.
ECS - 404 with apache && 502 with ALB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM ubuntu:18.04 | |
| RUN apt-get update && \ | |
| apt-get -y install apache2 | |
| RUN echo 'Hello World!' > /var/www/html/index.html | |
| # Configure apache | |
| RUN echo '. /etc/apache2/envvars' > /root/run_apache.sh && \ | |
| echo 'mkdir -p /var/run/apache2' >> /root/run_apache.sh && \ | |
| echo 'mkdir -p /var/lock/apache2' >> /root/run_apache.sh && \ | |
| echo '/usr/sbin/apache2 -D FOREGROUND' >> /root/run_apache.sh && \ | |
| chmod 755 /root/run_apache.sh | |
| EXPOSE 80 | |
| CMD /root/run_apache.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment