- 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
Privateis 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 triggerto 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
Stagingenvironment.-
Select
Create an App Runner serviceorCreate service. -
Under Source, confirm
Container registryandAmazon ECRare selected. -
Under
Container image URI, selectBrowse. -
Select the image repo you created and confirm the
latestappears 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 roleand select the role. -
Select
Next. -
Enter a name for the service. Add
stagingas 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
Productionenvironment.Use the same steps and settings as
Stagingwith one exception:For the
Productionservice, make sure that the Manual trigger is selected.
-
Select each App Runner service and save the values for:
Default domainService ARN
-
Back in the repo, create an environment for
Production. (TheStagingenvironment 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_ARNandURLusing the values from the App Runner configuration for Production. - Select
Save protection rules.
- Select
-
Edit the
Stagingenvironment. -
Under
Environment variables, selectAdd variable. -
Create variables for
SERVICE_ARNandURLusing the values from the App Runner configuration for Staging.
- Select the
Actionstab. - 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
deleteand selectDelete.
- Remove ECR repos.
- Browse to the ECR homepage
- Select the checkbox next to the name of the repo.
- Select
Delete. - Enter the word
deleteand selectDelete.