Source
yaml
id: s3-trigger
namespace: company.team
tasks:
- id: each
type: io.kestra.plugin.core.flow.ForEach
concurrencyLimit: 0
values: "{{ trigger.objects | jq('.[].uri') }}"
tasks:
- id: s3_object
type: io.kestra.plugin.core.debug.Return
format: "{{ taskrun.value }}"
triggers:
- id: wait_for_s3_object
type: io.kestra.plugin.aws.s3.Trigger
bucket: declarative-orchestration
prefix: demo
interval: PT1S
filter: FILES
action: MOVE
moveTo:
key: archive/demo/
region: "{{ secret('AWS_DEFAULT_REGION') }}"
accessKeyId: "{{ secret('AWS_ACCESS_KEY_ID') }}"
secretKeyId: "{{ secret('AWS_SECRET_ACCESS_KEY') }}"
About this blueprint
S3 Trigger
This flow will be triggered whenever new files with a given prefix are detected in the specified S3 bucket. It will download the files into the internal storage and move the S3 objects to an archive
folder (i.e. S3 object prefix with the name archive
).
The FoEach
task will iterate over the objects and print their URIs.
It's recommended to set the accessKeyId
and secretKeyId
properties as secrets.
This flow assumes AWS credentials stored as secrets AWS_ACCESS_KEY_ID
, AWS_SECRET_ACCESS_KEY
and AWS_DEFAULT_REGION
.
More Related Blueprints