- Create a new repo.
- Review the steps in Create a Service Account to add service account credentials to the repo
-
In your AWS account, go the ECR homepage
-
Select
Get started
. -
Under settings, confirm
Private
is selected -
Give the repo a name.
For our deployment workflow to operate correctly, the container repo needs to have the same name as the GitHub repo.
-
Keep the defaults for everything else, scroll to the bottom, and select
Create repository
. -
Back in the GitHub repo, use the
workflow dispatch trigger
to start a new run of the Container Deployment pipeline. -
Wait for the workflow run to complete. It will likely fail.
-
On the ECR page, select the repo you created earlier.
-
Confirm that an image has been pushed to the repo.
-
Browse to the App Runner homepage
-
Create an App Runner service for the
Staging
environment.-
Select
Create an App Runner service
orCreate service
. -
Under Source, confirm
Container registry
andAmazon ECR
are selected. -
Under
Container image URI
, selectBrowse
. -
Select the image repo you created and confirm the
latest
appears underImage tag
. -
Select
Continue
. -
Under
Deployment settings
, selectAutomatic
.This will configure App Runner to watch our container repo in ECR. When a new image is pushed, the service will be updated with the new image right away.
-
Under
ECR access role
, selectCreate new service role
. If you already have a service role in place, selectUse existing service role
and select the role. -
Select
Next
. -
Enter a name for the service. Add
staging
as a prefix or suffix so you can identify the service. You may also consider using the repo name here as well. -
Under
Virtual CPU
, select0.25 VCPU
. -
Leave everything else as the defaults and go to the next screen by selecting
Next
. -
Review your settings, scroll to the bottom of the screen, and select
Create & Deploy
.
-
-
Create an App Runner service for the
Production
environment.Use the same steps and settings as
Staging
with one exception:For the
Production
service, make sure that the Manual trigger is selected.
-
Select each App Runner service and save the values for:
Default domain
Service ARN
-
Back in the repo, create an environment for
Production
. (TheStaging
environment should already be in place, created by a workflow run.)- Select
Settings
->Environments
->New environment
. - For the name,
Production
. - Select
Configure environment
. - Select
Required reviewers
. - In the search field, enter your GitHub user name and select it.
- Select
Save protection rules
. - Under
Environment variables
, selectAdd variable
. - Create variables for
SERVICE_ARN
andURL
using the values from the App Runner configuration for Production. - Select
Save protection rules
.
- Select
-
Edit the
Staging
environment. -
Under
Environment variables
, selectAdd variable
. -
Create variables for
SERVICE_ARN
andURL
using the values from the App Runner configuration for Staging.
- Select the
Actions
tab. - Select
0-Container Deployment Pipeline
. - Select
Run workflow
->Run workflow
. - Observe the pipeline's progress.
- When prompted, select
Review deployments
. - Select
Production
->Approve and deploy
. - Observe the pipeline's progress.
- Follow the links on the tiles for each job to view the deployed application.
To avoid costs associated with running resources in AWS, please remove them.
- Remove App Runner services:
- Browse to the App Runner homepage
- For each service:
- Select the service.
- Select
Actions
->Delete
. - Enter the word
delete
and selectDelete
.
- Remove ECR repos.
- Browse to the ECR homepage
- Select the checkbox next to the name of the repo.
- Select
Delete
. - Enter the word
delete
and selectDelete
.