Create ECR Repository

Action ID: roadiehq:aws:ecr:create
NPM Package:

@roadiehq/scaffolder-backend-module-aws

Description

Creates an Amazon ECR repository with specified settings such as tags, image mutability, and scan options.

Input Schema

PropertyTypeDescriptionRequired
tagsarray-
regionstring-
repoNamestring-
scanOnPushboolean-
imageMutabilityboolean-

Output Schema

No output schema defined for this action.

Usage Examples

Create a dev ECR repository with scanning enabled

Fetch source with fetch:template then create a development ECR repository in us-east-1. This sets scanOnPush to true and imageMutability to true and applies basic tags.

Copy
steps:
  - id: fetch
    action: fetch:template
    input:
      url: ./skeleton

  - id: create-ecr-dev
    action: roadiehq:aws:ecr:create
    input:
      repoName: ${{ parameters.serviceId }}-dev
      region: us-east-1
      scanOnPush: true
      imageMutability: true
      tags:
        - Key: environment
          Value: dev
        - Key: team
          Value: platform

Create a production ECR repository with imageMutability set to false

Use this when provisioning a production repository in us-west-2. It fetches the template with fetch:template and creates the repo with scanOnPush enabled and imageMutability set to false.

Copy
steps:
  - id: fetch
    action: fetch:template
    input:
      url: ./service-template

  - id: create-ecr-prod
    action: roadiehq:aws:ecr:create
    input:
      repoName: billing-service-prod
      region: us-west-2
      scanOnPush: true
      imageMutability: false
      tags:
        - Key: environment
          Value: prod
        - Key: service
          Value: billing-service
        - Key: owner
          Value: payments-team

Parameterize region and repository name from template inputs

Let users pick the AWS region and repository name at scaffolding time. This example passes through parameters for repoName, region, and optional settings, after fetching files with fetch:template.

Copy
steps:
  - id: fetch
    action: fetch:template
    input:
      url: ./templates/container-app

  - id: create-ecr-param
    action: roadiehq:aws:ecr:create
    input:
      repoName: ${{ parameters.repoName }}
      region: ${{ parameters.awsRegion }}
      scanOnPush: ${{ parameters.scanOnPush }}
      imageMutability: ${{ parameters.imageMutability }}
      tags: ${{ parameters.tags }}

Create a staging repository in EU region with compliance tags

Create a staging repository in eu-west-1 with scanning enabled. Use this when deploying workloads in EU regions and include tags for compliance tracking; source is fetched with fetch:template.

Copy
steps:
  - id: fetch
    action: fetch:template
    input:
      url: ./service-skeleton

  - id: create-ecr-staging
    action: roadiehq:aws:ecr:create
    input:
      repoName: ${{ parameters.componentId }}-staging
      region: eu-west-1
      scanOnPush: true
      imageMutability: true
      tags:
        - Key: environment
          Value: staging
        - Key: compliance
          Value: internal
        - Key: cost-center
          Value: CC-4271

Create a temporary repository for preview environments

Provision an ECR repository for short-lived preview deployments. It sets scanOnPush to false and adds tags to indicate TTL and cleanup, after fetching with fetch:template.

Copy
steps:
  - id: fetch
    action: fetch:template
    input:
      url: ./preview-app

  - id: create-ecr-preview
    action: roadiehq:aws:ecr:create
    input:
      repoName: ${{ parameters.serviceId }}-pr-${{ parameters.prNumber }}
      region: us-east-2
      scanOnPush: false
      imageMutability: true
      tags:
        - Key: environment
          Value: preview
        - Key: ttl
          Value: 7d
        - Key: cleanup
          Value: true