Deploy Containerized Apache Application On ECS Using ECR
Deploy Containerized Apache Application On ECS Using ECR
By
Mahendran Selvakumar
https://devopstronaut.com/
https://www.linkedin.com/in/mahendran-selvakumar-36444a77/
1.Create ECR Repository for ECS Container
https://www.linkedin.com/in/mahendran-selvakumar-36444a77/
Click "Create repository"
Provide a username
https://www.linkedin.com/in/mahendran-selvakumar-36444a77/
Add the user to the admin group. Here, you can also restrict access with a custom
policy
https://www.linkedin.com/in/mahendran-selvakumar-36444a77/
Click "Create user"
Go to the new user and create an Access key for AWS CLI
https://www.linkedin.com/in/mahendran-selvakumar-36444a77/
Select "Command line interface (CLI)"
Enter a description for the access key and click “create access key”
Copy the access key and secret key, as the secret key value will not be visible again
https://www.linkedin.com/in/mahendran-selvakumar-36444a77/
To verify if AWS CLI is installed and available on your system, you can run the following
command in your terminal or command prompt. If AWS CLI is installed, this command
will display the version information. If it is not installed, you'll receive an error message
indicating that the command is not recognized
https://www.linkedin.com/in/mahendran-selvakumar-36444a77/
• Default output format: Enter your preferred output format (e.g., Json, text, or
yaml).
https://www.linkedin.com/in/mahendran-selvakumar-36444a77/
Retrieve an authentication token and authenticate your Docker client to your registry. Use the
AWS CLI
Tag your image so you can push the image to this repository
Run the following command to push this image to your newly created AWS repository
https://www.linkedin.com/in/mahendran-selvakumar-36444a77/
4.Create ECS Cluster
Enter a cluster name and choose "AWS Fargate" so that the cluster is automatically
configured for AWS Fargate
https://www.linkedin.com/in/mahendran-selvakumar-36444a77/
The Cluster has been created successfully
https://www.linkedin.com/in/mahendran-selvakumar-36444a77/
Create Task definition
Specify the task definition family and set the launch type to "AWS Fargate"
Enter the container name, provide the ECR image URI, and specify the port name
https://www.linkedin.com/in/mahendran-selvakumar-36444a77/
You can verify the created task by checking the container name
https://www.linkedin.com/in/mahendran-selvakumar-36444a77/
Create ECS Service
Choose the existing cluster and select compute option as “capacity provider”
https://www.linkedin.com/in/mahendran-selvakumar-36444a77/
Provide the Service name and specify the desired tasks to “1”
https://www.linkedin.com/in/mahendran-selvakumar-36444a77/
In the Networking section, choose the VPC, subnet, and security group
https://www.linkedin.com/in/mahendran-selvakumar-36444a77/
It will take more time to create the service
Verify the task status after the service has been created
https://www.linkedin.com/in/mahendran-selvakumar-36444a77/
Go to Tasks configuration and Copy the Public IP Address from Task
Paste the IP address to the browser and now you should be able to access the Apache
website from AWS ECS.
https://www.linkedin.com/in/mahendran-selvakumar-36444a77/
Keep Learning, Keep Automating!!!
Feel free to reach out to me, if you have any other queries or suggestions
https://www.linkedin.com/in/mahendran-selvakumar-36444a77/