AWS App Runner : AWS App Runner is a fully managed service that makes it easy for developers to deploy from source code or container image directly to a scalable and secure web application.
Benefits :
- Easy to use
- Saves time
- Scales with traffic
Features:
- Automatic Deployments
- Logs and metrics
- Load Balancing
- Auto Scaling
- Secure by design
Use cases:
- Frontend and backend web applications
- Microservices and APIs
- Rapid production deployments
Pre-requisties for AWS APP Runner :
Task :Create Image and Push to ECR Repository
Launch EC2 instance - Amazon Linux 2 AMI, t2.micro
Connect to instance using EC2 Instance Connect
Run the following commands on EC2:
sudo su
yum update
yum install docker
systemctl enable docker.service
systemctl start docker.service
docker pull nginx
docker images
Create an IAM role ECR_Role and attach the policy
{
"Version": "2012-10-17",
"Id": "ECRPolicy",
"Statement": [
{
"Sid": "AllowAll",
"Effect": "Allow",
"Action": "ecr:*",
"Resource": "*"
}
]
}
1.Attach role - ECR_Role to EC2 instance and then run the following commands
2.Create ECR Repository
aws ecr create-repository --repository-name nginx --region eu-west-1
3.Tag the image and which we created earlier then replace ACCOUNT_Number with your account number
docker tag nginx:latest ACCOUNT_Number.dkr.ecr.eu-west-1.amazonaws.com/nginx:latest
4.Authenticate ECR login, replace ACCOUNT_Number with your account number.
aws ecr get-login-password --region eu-west-1 | docker login --username AWS --password-stdin ACCOUNT_Number.dkr.ecr.eu-west-1.amazonaws.com/nginx
5.Push the image to ecr and replace ACCOUNT_Number with your account number.
docker push ACCOUNT_Number.dkr.ecr.eu-west-1.amazonaws.com/nginx:latest
Note : From the above points 3,4 and 5, i have used the region ireland : eu-west-1 and change based on your preference.
Step by Step Approach for AWS App Runner creation
Step 1 :
Step 2:
Source can be chosen from two options
- Container Registry (selected this option for the demo)
- Source Code Repository
Step 3:
Select Container image URI by clicking on the Browse button
Then select the image
Step 4: Select Deployment Trigger
- Manual / Automatic
- ECR Access Role -> Select create new service role -> Role with name AppRunnerECRAccessRole will be created Then click on next
Step 5: Configure Service
Step 5.1: Give the service name as nginx-service and port as 80
Step 5.2 : Keep the remaining settings as it is and then click Next
Step 6 : Review and Create
Step 7: Deployment in progress
Step 8: Select Default domain as per the below screenshot - https://53zz55dm4a.eu-west-1.awsapprunner.com/
step 9 : Render the url - https://53zz55dm4a.eu-west-1.awsapprunner.com/
Step 10 : Deleting the App Runner - service
Confirm the deletion by typing delete and then click on Delete
Step 11 : Deleting in progress
Step 12 : Also delete EC2 created in the pre-requisite tasks.
Conclusion:
- Created Image and Push to ECR Repository
- Created APP Runner and used the image created
- Rendered the APP Runner URL generated
- Destroyed APP Runner service
š¬ If you enjoyed reading this blog post and found it informative, please take a moment to share your thoughts by leaving a review and liking it š and follow me in linkedin
Top comments (0)