Skip to content
This repository has been archived by the owner on Feb 28, 2023. It is now read-only.

Simple AWS App Runner example with pipeline actions to Dockerise an Express API, push the image to ECR and deploy an AWS App Runner service using CloudFormation.

Notifications You must be signed in to change notification settings

jh-kainos/aws-app-runner-example

Repository files navigation

Build, Tag and Push Docker image to ECR

aws-app-runner-example

This is a basic example of how to deploy a container image to an AWS App Runner service. The API is located in the express-ts-api folder and was generated with npx express-generator-typescript.

The Express API is containerised and deployed using the included GitHub action.

Prerequisities

  1. node
  2. npm
  3. AWS API credentials and an IAM role to assume (there is an IAM policy included but it has not been extensively tested and assumes the use of default CF parameter values and requires you to replace ${AWSRegion} and ${AWSAccountId} with your desired deployment region and AWS account ID)

Setup

  1. Install node modules with npm
cd express-ts-api
npm install
  1. Create an Elastic Container Repository in AWS (manually create or deploy included ecr.yml)
  2. If using GitHub Actions to build the image and deploy the stack:
    1. Configure GitHub Secrets:
      1. AWS_ACCESS_KEY: AWS API Access Key
      2. AWS_ECR_REPO: URI of image repository created in step 2
      3. AWS_REGION: AWS Region to deploy AWS App Runner in
      4. AWS_ROLE_TO_ASSUME: An IAM Role to assume for stack deployment
      5. AWS_SECRET_KEY: AWS API Secret Key

Run Express API locally

Run the following:

npm build
npm run start:dev

About

Simple AWS App Runner example with pipeline actions to Dockerise an Express API, push the image to ECR and deploy an AWS App Runner service using CloudFormation.

Topics

Resources

Stars

Watchers

Forks