AWS App Runner is the easiest way to deploy your Containerized, Node, or Python-based services. You don't have to worry about managing infrastructure or scaling up and down the resources when the load increases or decreases.
ℹ️ Note: It's assumed that you are familiar with AWS ECR and your image has already been containerized and pushed. If you are new to AWS ECR then read this first.
To deploy your services on AWS App Runner, navigate to AWS App Runner from the AWS console
From there click on "Create an App Runner service"
Now you need to provide the source image - which AWS App Runner will deploy as a service. For this, select "Container Registry", "Amazon ECR" (select Public, if your image is not private) and paste the Container image URI (you can get it from AWS ECR)
Next configure the deployment settings for your service. Select "Automatic" (it will deploy a new version of your service as soon as the new image has been pushed), "Create new service role" and "Next"
Give any name to your backend service, select vCPU and memory as per the need (expected load/traffic), and enter environment variables (if needed) as key/value pairs
In the "Auto-scaling" settings, you can use the default one or if you need to adjust them then create a "Custom configuration"
Concurrency: Max. number of concurrent requests/connections after which a new instance will be launched
Minimum size: It's the minimum number of instances that will always be running regardless of load
Maximum Size: Maximum number of instances you want AWS App runner to launch when the load increases (in this case more than 100 concurrent requests/connections)
The health check is a mechanism to know whether the service is performing and stable or not. You can leave the default settings or configure them as needed
By default, the Unhealthy threshold is set to 5. This essentially means that whenever 5 health check requests from the load balancer to an instance fails, it will consider it unhealthy and try to replace it.
Next, you can create a custom IAM role from the https://aws.amazon.com/iam/ that will give permissions to your container to communicate with other AWS services or you can leave it. To encrypt the stored image (if you chose ECR image ) or stored source code bundle (if you chose GitHub, earlier) you can use AWS-owned encryption key or customer-managed key CMK (can be created from https://aws.amazon.com/kms/.
By default, if you don't provide one, an AWS-owned encryption key is used.
Tags are optional key/value pairs to help you identify and group your AWS resources. Add tags if needed and then click "Next"
Review your configurations and click "Create & Deploy"
It will take some time to build your app, once the status changes from "Operation in progress" to "Completed", your changes are deployed
Once the service has deployed successfully, get the default domain link and see it in action
Let's make some changes to your code and push it (build the docker image and push to AWS ECR - you will notice that the build process triggers automatically and deploys the new version
Notes: AWS App Runner offers the easiest and quickest way to run containerized applications. If you don't want to use conainerized application(s), then you can also deploy your nodejs or python based services on AWS App Runner from Github.
Originally posted on: dev.to
Let's connect:
Linkedin: https://www.linkedin.com/in/mubbashir10/
Twitter: https://twitter.com/mubbashir100