This task performs operations on Amazon Web Services resources using aws
.
All aws cli commands can be found here.
kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/aws-cli/0.2/raw
- SCRIPT: The script of aws commands to execute e.g.
aws $1 $2
This will take the first value and second value of ARGS ass3
andls
(default:aws $@
) - ARGS: The arguments to pass to
aws
CLI, which are appended toaws
e.g.s3 ls
( default:["help"]
).
- source: To mount file which is to be uploaded to the aws resources, this should be mounted using any volume supported in workspace.
- secrets: A workspace that consists of credentials required by
aws
which will be mounted to $HOME/.aws. This workspace can be omitted when using instance-profile credentials.
AWS credentials
and config
both should be provided in the form of secret
.
This example can be referred to create aws-credentials
.
Refer this guide for setting up AWS Credentials and Region.
The Task can be run on linux/amd64
platform.
After creating the task, you should now be able to execute aws
commands by
specifying the command you would like to run as the ARGS
or SCRIPT
param.
The ARGS
param takes an array of aws subcommands that will be executed as
part of this task and the SCRIPT
param takes the multiple commands that you would like to run on aws CLI.
This samples, can be referred to create secret file for aws credentials.
In the samples, ConfigMap as the volume is used. In place of ConfigMap, any volume supported in workspace can be used.
Following command
can be used to create ConfigMap
from the file
.
kubectl create configmap upload-file --from-file=demo.zip
Here upload-file
is the name of the ConfigMap
, this can be changed based on the requirements.
See here for example of aws s3
command.
-
Either
SCRIPT
orARGS
must be provided in theparams
of the task. -
To support multiple
aws
commands to run on a single task, SCRIPT can be used as follows:- name: SCRIPT value: | aws s3 mb s3://test-bucket aws s3api put-object --bucket test-bucket --key test/ aws s3 cp $(workspaces.source.path)/demo.zip s3://test-bucket/test/demo.zip