Blueprints

Automate tasks on AWS using the AWS CLI

Source

yaml
id: awscli-list-ecs-clusters
namespace: company.team

tasks:
  - id: awscli
    type: io.kestra.plugin.aws.cli.AwsCLI
    accessKeyId: "{{ secret('AWS_ACCESS_KEY_ID') }}"
    secretKeyId: "{{ secret('AWS_SECRET_ACCESS_KEY') }}"
    region: us-east-1
    outputFiles:
      - output.json
    commands:
      - aws ecs list-clusters --query 'clusterArns[*]'
      - aws ecs list-clusters > output.json

About this blueprint

AWS

This flow demonstrates how you can use the AWS CLI plugin to automate various tasks on AWS. The task aws below runs two commands. They both list ECS clusters in the region us-east-1 using the aws ecs list-clusters command. The output is a JSON array of cluster ARNs.

  1. The first task uses the --query parameter to filter the output to only show the cluster ARNs. 2. The second task stores the output to a file called output.json, making it available for further processing or download. This flow assumes AWS credentials stored as secrets AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.

Aws CLI

More Related Blueprints

New to Kestra?

Use blueprints to kickstart your first workflows.

Get started with Kestra