Skip to content

Latest commit

 

History

History
44 lines (26 loc) · 2.67 KB

README.md

File metadata and controls

44 lines (26 loc) · 2.67 KB

AWS App Runner - Page Impression Counter App

This repository was built for demoing how to deploy a "Bring your own code" project to AWS App Runner, following a short clip that was uploaded to YouTube in Hebrew. In the short clip you will be able to see a step by step console demo, and this repository will demonstrate how to deploy the app using AWS Cli.

The application is a very simple page impression counter nodejs app for demo purposes only, that is built and deployed to AWS App Runner service, the app will use a DynamoDB table as described in the following diagram as a counter.

diagram

Prerequisite

  1. awscli >= 2.2.34, if you are using AWS CLI version 1, you might get errors on --no-cli-pager switch of Unknown options, you can remove it from the scripts.
  2. In AWS App Runner console, create a GitHub connection, and named it github as described in our documentation.

Deploying the App

In the ./scripts folder are all the scripts that you can use to deploy this app.

Steps:

  1. 1_prep_dynamodb.sh - Creates the counter DynamoDB table.
  2. 2_permissions.sh - Creates proper permissions for app runner task to access DynamoDB securely.
  3. Create App Runner service with Github hook auto deployment 3_apprunner_github.sh, Make sure to update the REPO_URL variable with yours before running the script. the AWS Connector that was configured in the prerequisite, should have access to this repo.
  4. showing the auto scale with stressing the application with wrk using 4_stress_test.sh

Optional Deployment from ECR

In AWS App Runner, in addition built and run your code, as described above, you also have the option to run your container. In order to deploy your container, you will need to build this app using the Dockerfile and push it to your ECR Repository.

Make sure you have Docker installed and running, and you have IAM permissions to create and push to an ECR repository.

Steps:

  1. To create an ECR repository, build and push the application docker image 5_create_ecr_build_push.sh
  2. Create access role, to allow App Runner to pull images from ECR using 6_permissions_ecr.sh
  3. Create App Runner service with ECR auto deployment 7_apprunner_ecr.sh

Security

See CONTRIBUTING for more information.

License

This repository is licensed under the MIT-0 License. See the LICENSE file.