ARCHITECTURE DIAGRAM
STEPS
- Login to AWS and navigate to EC2 to create an instance, not forgetting to attach a keypair to the instance.
- Using the SSH client option to connect remotely into the instance.
- Using Mobaxterm to connect remotely the instance via SSH by specifying public IPV4, username and path to the keypair.
- SSH is successful and tested using whoami command.
- Install docker using root priviledges and yum.
- Docker installation is complete.
- Start docker using systemctl and ensure it is active.
- Create and directory and navigate to this directory, create a Dockerfile (a text document that contains all the commands a user could call on the command line to assemble an image) and input the command below using any preferred editor (I used vim editor).
- Create and edit an index.html file.
- Build the image using the docker build -t command (. means in the current directory).
- Build is complete, centos is the base image.
- Run the commands below to view docker images (docker images) and running containers (docker ps -a).
- Run app using public DNS.
- Navigate to ECR on AWS to create a private repo where built image will be pushed to.
- Create a role for IAM user (with programmatic access) for ECR.
- Configure credential (access key and secret access key of user) using aws configure.
- Use push commands from ecr repo to push my image to ECR.
- I had issues continuing as a non-root user while trying to login.
- I switched to root user using sudo su command and login was successful.
- Using docker images command to check my images and tagging my image before pushing to ECR.
- I pushed my image to my private repo on ECR.
- My image is visible on Amazon ECR (ECR is a registry for images).
- More details about my image.
- Create a target group to attach to an application load balancer (notice the target group is not associated to a LB yet).
- Create an application load balancer (summary of my ALB details).
- ALB is active with high availability (more than 1 AZ).
- Create a task execution role that grants the Amazon ECS container and Fargate agents permission to make AWS API calls on our behalf.
- Create a task definiton that describes the containers that forms our application.
- Create a cluster which is a group of ECS container instances.
- Create a service that defines the minimum and maximum task from a task definition.
- A list of tasks using fargate as launch type (a task is an instance of a task definition).
- This shows a deployment and events for ECS.
- Using ALB DNS to view my web app.
- To avoid being charged, I cleaned up my resources by terminating my instance and deleting other resources.