Set up an ECR Repository
This document describes how to create a new Amazon ECR (Elastic Container Registry) repository in the AWS Shared account using the BYM-IKT/SharedKontoInfrastruktur repository.
An ECR repository is used to store container images so that containerized applications can be deployed to AWS.
Prerequisites
- Access to the repository: BYM-IKT/SharedKontoInfrastruktur
- Git installed
- A shell environment that supports symbolic links (Linux, macOS, WSL, or Git Bash)
Note
Step 2b must be performed in an environment that supports symbolic links.
Steps
Step 1. Clone the repository
Step 2. Verify application folder
Check if the following folder exists:
- If the folder exists, continue to step 3.
- If the folder does not exist, follow the steps below.
Step 2a — Copy the Example Template
Step 2b — Rename Terraform Template Files
Navigate to:
Rename the files:| From | To |
|---|---|
main.tfignore |
main.tf |
state.tfignore |
state.tf |
Step 2c — Replace Template Name
Replace all occurrences of the word eksempel with <application-name>
in the following files:
- ./Shared/<application-name>/eu-west-1/environment.tf
- ./Shared/<application-name>/eu-west-1/ecr/main.tf
- ./Shared/<application-name>/eu-west-1/ecr/state.tf
Expected Folder Structure
Shared/
└── <application-name>/ ← Renamed folder
└── eu-west-1/
├── ecr/
│ ├── main.tf ← Renamed and edited
│ ├── state.tf ← Renamed and edited
│ └── ...
└── environment.tf ← Edited
Step 3. Define the ECR Repository Name
Open:
In the locals block, add the desired ECR repository name to the list:| ./Shared/kattehotell/eu-west-1/ecr/main.tf | |
|---|---|
Step 4. Create a Pull Request
-
Create a new branch
-
Commit your changes
-
Push the branch
-
Create a Pull Request to
master
Step 5. Merge to Master
After the Pull Request is merged into master,
the ECR repository will be automatically created.
Result
The ECR repository will be available at: