Blueprints

Pull a container image from Amazon ECR registry and run a Python script

Source

yaml
id: python-aws-ecr
namespace: company.team

tasks:
  - id: ecr
    type: io.kestra.plugin.aws.ecr.GetAuthToken
    accessKeyId: "{{ secret('AWS_ACCESS_KEY_ID') }}"
    secretKeyId: "{{ secret('AWS_SECRET_ACCESS_KEY') }}"
    region: eu-central-1

  - id: py
    type: io.kestra.plugin.scripts.python.Commands
    taskRunner:
      type: io.kestra.plugin.scripts.runner.docker.Docker
      credentials:
        username: AWS
        password: "{{ outputs.ecr.token }}"
    containerImage: 123456789.dkr.ecr.eu-central-1.amazonaws.com/data-infastructure:latest
    commands:
      - python --version

About this blueprint

CLI Docker AWS Python

This flow will retrieve an authorization token to authenticate with the Amazon ECR. Then, it will pull the specified image and will run a Python script (or whichever command you wish) in a Docker container. This flow assumes AWS credentials stored as secrets AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.

Get Auth Token

Commands

Docker

More Related Blueprints

New to Kestra?

Use blueprints to kickstart your first workflows.

Get started with Kestra