Skip to content

Commit a28401d

Browse files
authored
fix(docs): s3 upload example
1 parent bf7db61 commit a28401d

File tree

1 file changed

+40
-4
lines changed

1 file changed

+40
-4
lines changed

src/main/java/io/kestra/plugin/aws/s3/Upload.java

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,24 +39,60 @@
3939
examples = {
4040
@Example(
4141
full = true,
42+
title = "Upload a FILE input to S3",
4243
code = """
4344
id: aws_s3_upload
4445
namespace: company.team
4546
4647
inputs:
48+
- id: bucket
49+
type: STRING
50+
defaults: my-bucket
51+
4752
- id: myfile
4853
type: FILE
4954
5055
tasks:
5156
- id: upload
5257
type: io.kestra.plugin.aws.s3.Upload
53-
accessKeyId: "<access-key>"
54-
secretKeyId: "<secret-key>"
55-
region: "eu-central-1"
58+
region: "{{ secret('AWS_DEFAULT_REGION') }}"
59+
accessKeyId: "{{ secret('AWS_ACCESS_KEY_ID') }}"
60+
secretKeyId: "{{ secret('AWS_SECRET_KEY_ID') }}"
5661
from: "{{ inputs.myfile }}"
57-
bucket: "my-bucket"
62+
bucket: "{{ inputs.bucket }}"
5863
key: "path/to/file"
5964
"""
65+
),
66+
@Example(
67+
full = true,
68+
title = "Download a file and upload it to S3",
69+
code = """
70+
id: upload_file_to_s3
71+
namespace: company.team
72+
73+
inputs:
74+
- id: bucket
75+
type: STRING
76+
defaults: my-bucket
77+
78+
- id: file_url
79+
type: STRING
80+
defaults: https://wri-dataportal-prod.s3.amazonaws.com/manual/global_power_plant_database_v_1_3.zip
81+
82+
tasks:
83+
- id: download_file
84+
type: io.kestra.plugin.core.http.Download
85+
uri: "{{ inputs.file_url }}"
86+
87+
- id: upload_to_s3
88+
type: io.kestra.plugin.aws.s3.Upload
89+
from: "{{ outputs.download_file.uri }}"
90+
key: powerplant/global_power_plant_database.zip
91+
bucket: "{{ inputs.bucket }}"
92+
region: "{{ secret('AWS_DEFAULT_REGION') }}"
93+
accessKeyId: "{{ secret('AWS_ACCESS_KEY_ID') }}"
94+
secretKeyId: "{{ secret('AWS_SECRET_KEY_ID') }}"
95+
"""
6096
)
6197
}
6298
)

0 commit comments

Comments
 (0)