AWS App Runner: Simplify Your Deployment
Introduction
AWS App Runner is a fully managed service that helps developers easily deploy containerized web applications and APIs quickly without worrying about managing complex server infrastructure or Kubernetes clusters. With App Runner, you only need to provide source code or a container image; the service will automatically handle everything from building and deployment to load balancing and traffic encryption.
Advantages
- Maximum Simplification: No need to configure VPCs, set up Load Balancers, or manage security patches for the operating system. Everything is automated by AWS "from A to Z".
- Auto Scaling: The system automatically adjusts the number of resources based on actual traffic. When there are no requests, the application can maintain a minimum level to save costs.
- Seamless CI/CD Integration: App Runner supports direct connection to source code repositories (such as GitHub) or container registries (Amazon ECR). When you push new code, the service will automatically trigger the Automatic Deployment process.
- Security by Default: Applications run in isolated environments and come with built-in HTTPS (TLS) support. You can also easily manage access permissions through IAM Roles.
- Reasonable Cost: You only pay for the compute resources (CPU and Memory) that the application actually consumes, helping to optimize the budget for projects or microservices.
Detail
Using AWS CDK, first create the file lib/app-runner-stack.ts
- accessRole: create a role to allow App Runner to have permission to pull docker images from AWS ECR
- instanceRole: create a role to allow App Runner to have permission to use S3
- appRunnerService: create an App Runner with the following main information
- imageRepository: define information about docker image, port, and environment variables
- authenticationConfiguration: add the created accessRole information
- instanceConfiguration: add machine config and the created instanceRole information
Update the file bin/aws-cdk.ts to use the stack just created
Result after deployment
Corresponding resource created on AWS Console
Check using Postman
View logs during operation as follows
Happy coding!
Comments
Post a Comment