Creating a Batch Operations job with job tags used for labeling
You can label and control access to your Amazon S3 Batch Operations jobs by adding tags. Tags can be used to identify who is responsible for a Batch Operations job. You can create jobs with tags attached to them, and you can add tags to jobs after they are created. For more information, see Controlling access and labeling jobs using tags.
The following Amazon CLI example creates an S3 Batch Operations S3PutObjectCopy job
using job tags as labels for the job.
-
Select the action or
OPERATIONthat you want the Batch Operations job to perform, and choose yourTargetResource.read -d '' OPERATION <<EOF { "S3PutObjectCopy": { "TargetResource": "arn:aws-cn:s3:::amzn-s3-demo-destination-bucket" } } EOF -
Identify the job
TAGSthat you want for the job. In this case, you apply two tags,departmentandFiscalYear, with the valuesMarketingand2020respectively.read -d '' TAGS <<EOF [ { "Key": "department", "Value": "Marketing" }, { "Key": "FiscalYear", "Value": "2020" } ] EOF -
Specify the
MANIFESTfor the Batch Operations job.read -d '' MANIFEST <<EOF { "Spec": { "Format": "EXAMPLE_S3BatchOperations_CSV_20180820", "Fields": [ "Bucket", "Key" ] }, "Location": { "ObjectArn": "arn:aws-cn:s3:::amzn-s3-demo-manifest-bucket/example_manifest.csv", "ETag": "example-5dc7a8bfb90808fc5d546218" } } EOF -
Configure the
REPORTfor the Batch Operations job.read -d '' REPORT <<EOF { "Bucket": "arn:aws-cn:s3:::amzn-s3-demo-completion-report-bucket", "Format": "Example_Report_CSV_20180820", "Enabled": true, "Prefix": "reports/copy-with-replace-metadata", "ReportScope": "AllTasks" } EOF Run the
create-jobaction to create your Batch Operations job with inputs set in the preceding steps.aws \ s3control create-job \ --account-id123456789012\ --manifest "${MANIFEST//$'\n'}" \ --operation "${OPERATION//$'\n'/}" \ --report "${REPORT//$'\n'}" \ --priority 10 \ --role-arn arn:aws-cn:iam::123456789012:role/batch-operations-role\ --tags "${TAGS//$'\n'/}" \ --client-request-token "$(uuidgen)" \ --regionus-west-2\ --description "Copy with Replace Metadata";
To create an S3 Batch Operations job with tags using the Amazon SDK for Java, you can use the S3Control client to configure job parameters including manifest location, job operations, reporting settings, and tags for organization and tracking purposes.
For examples of how to create S3 Batch Operations jobs with tags using the Amazon SDK for Java, see Create a batch job to copy objects in the Amazon S3 API Reference.