You can use Amazon S3 Batch Operations to perform large-scale Batch Operations on Amazon S3 objects. Amazon S3 Batch Operations can execute a single operation or action on lists of Amazon S3 objects that you specify. For more information, see Amazon S3 Batch Operations in the Amazon Simple Storage Service Developer Guide.
Related actions include:
DescribeJob
ListJobs
UpdateJobPriority
UpdateJobStatus
See also: AWS API Documentation
See ‘aws help’ for descriptions of global parameters.
create-job
--account-id <value>
[--confirmation-required | --no-confirmation-required]
--operation <value>
--report <value>
[--client-request-token <value>]
--manifest <value>
[--description <value>]
--priority <value>
--role-arn <value>
[--tags <value>]
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]
[--cli-auto-prompt <value>]
--account-id
(string)
--confirmation-required
| --no-confirmation-required
(boolean)
Indicates whether confirmation is required before Amazon S3 runs the job. Confirmation is only required for jobs created through the Amazon S3 console.
--operation
(structure)
The operation that you want this job to perform on each object listed in the manifest. For more information about the available operations, see Available Operations in the Amazon Simple Storage Service Developer Guide .
LambdaInvoke -> (structure)
Directs the specified job to invoke an AWS Lambda function on each object in the manifest.
FunctionArn -> (string)
The Amazon Resource Name (ARN) for the AWS Lambda function that the specified job will invoke for each object in the manifest.
S3PutObjectCopy -> (structure)
Directs the specified job to execute a PUT Copy object call on each object in the manifest.
TargetResource -> (string)
CannedAccessControlList -> (string)
AccessControlGrants -> (list)
(structure)
Grantee -> (structure)
TypeIdentifier -> (string)
Identifier -> (string)
DisplayName -> (string)
Permission -> (string)
MetadataDirective -> (string)
ModifiedSinceConstraint -> (timestamp)
NewObjectMetadata -> (structure)
CacheControl -> (string)
ContentDisposition -> (string)
ContentEncoding -> (string)
ContentLanguage -> (string)
UserMetadata -> (map)
key -> (string)
value -> (string)
ContentLength -> (long)
ContentMD5 -> (string)
ContentType -> (string)
HttpExpiresDate -> (timestamp)
RequesterCharged -> (boolean)
SSEAlgorithm -> (string)
NewObjectTagging -> (list)
(structure)
Key -> (string)
Value -> (string)
RedirectLocation -> (string)
RequesterPays -> (boolean)
StorageClass -> (string)
UnModifiedSinceConstraint -> (timestamp)
SSEAwsKmsKeyId -> (string)
TargetKeyPrefix -> (string)
ObjectLockLegalHoldStatus -> (string)
The Legal Hold status to be applied to all objects in the Batch Operations job.
ObjectLockMode -> (string)
The Retention mode to be applied to all objects in the Batch Operations job.
ObjectLockRetainUntilDate -> (timestamp)
The date when the applied Object Retention configuration will expire on all objects in the Batch Operations job.
S3PutObjectAcl -> (structure)
Directs the specified job to execute a PUT Object acl call on each object in the manifest.
AccessControlPolicy -> (structure)
AccessControlList -> (structure)
Owner -> (structure)
ID -> (string)
DisplayName -> (string)
Grants -> (list)
(structure)
Grantee -> (structure)
TypeIdentifier -> (string)
Identifier -> (string)
DisplayName -> (string)
Permission -> (string)
CannedAccessControlList -> (string)
S3PutObjectTagging -> (structure)
Directs the specified job to execute a PUT Object tagging call on each object in the manifest.
TagSet -> (list)
(structure)
Key -> (string)
Value -> (string)
S3InitiateRestoreObject -> (structure)
Directs the specified job to execute an Initiate Glacier Restore call on each object in the manifest.
ExpirationInDays -> (integer)
GlacierJobTier -> (string)
S3PutObjectLegalHold -> (structure)
Contains the configuration parameters for a Set Object Legal Hold operation. Amazon S3 Batch Operations passes each value through to the underlying PUT Object Legal Hold API. For more information about the parameters for this operation, see PUT Object Legal Hold .
LegalHold -> (structure)
The Legal Hold contains the status to be applied to all objects in the Batch Operations job.
Status -> (string)
The Legal Hold status to be applied to all objects in the Batch Operations job.
S3PutObjectRetention -> (structure)
Contains the configuration parameters for a Set Object Retention operation. Amazon S3 Batch Operations passes each value through to the underlying PUT Object Retention API. For more information about the parameters for this operation, see PUT Object Retention .
BypassGovernanceRetention -> (boolean)
Indicates if the operation should be applied to objects in the Batch Operations job even if they have Governance-type Object Lock in place.
Retention -> (structure)
Amazon S3 object lock Retention contains the retention mode to be applied to all objects in the Batch Operations job.
RetainUntilDate -> (timestamp)
The date when the applied Object Retention will expire on all objects in the Batch Operations job.
Mode -> (string)
The Retention mode to be applied to all objects in the Batch Operations job.
JSON Syntax:
{
"LambdaInvoke": {
"FunctionArn": "string"
},
"S3PutObjectCopy": {
"TargetResource": "string",
"CannedAccessControlList": "private"|"public-read"|"public-read-write"|"aws-exec-read"|"authenticated-read"|"bucket-owner-read"|"bucket-owner-full-control",
"AccessControlGrants": [
{
"Grantee": {
"TypeIdentifier": "id"|"emailAddress"|"uri",
"Identifier": "string",
"DisplayName": "string"
},
"Permission": "FULL_CONTROL"|"READ"|"WRITE"|"READ_ACP"|"WRITE_ACP"
}
...
],
"MetadataDirective": "COPY"|"REPLACE",
"ModifiedSinceConstraint": timestamp,
"NewObjectMetadata": {
"CacheControl": "string",
"ContentDisposition": "string",
"ContentEncoding": "string",
"ContentLanguage": "string",
"UserMetadata": {"string": "string"
...},
"ContentLength": long,
"ContentMD5": "string",
"ContentType": "string",
"HttpExpiresDate": timestamp,
"RequesterCharged": true|false,
"SSEAlgorithm": "AES256"|"KMS"
},
"NewObjectTagging": [
{
"Key": "string",
"Value": "string"
}
...
],
"RedirectLocation": "string",
"RequesterPays": true|false,
"StorageClass": "STANDARD"|"STANDARD_IA"|"ONEZONE_IA"|"GLACIER"|"INTELLIGENT_TIERING"|"DEEP_ARCHIVE",
"UnModifiedSinceConstraint": timestamp,
"SSEAwsKmsKeyId": "string",
"TargetKeyPrefix": "string",
"ObjectLockLegalHoldStatus": "OFF"|"ON",
"ObjectLockMode": "COMPLIANCE"|"GOVERNANCE",
"ObjectLockRetainUntilDate": timestamp
},
"S3PutObjectAcl": {
"AccessControlPolicy": {
"AccessControlList": {
"Owner": {
"ID": "string",
"DisplayName": "string"
},
"Grants": [
{
"Grantee": {
"TypeIdentifier": "id"|"emailAddress"|"uri",
"Identifier": "string",
"DisplayName": "string"
},
"Permission": "FULL_CONTROL"|"READ"|"WRITE"|"READ_ACP"|"WRITE_ACP"
}
...
]
},
"CannedAccessControlList": "private"|"public-read"|"public-read-write"|"aws-exec-read"|"authenticated-read"|"bucket-owner-read"|"bucket-owner-full-control"
}
},
"S3PutObjectTagging": {
"TagSet": [
{
"Key": "string",
"Value": "string"
}
...
]
},
"S3InitiateRestoreObject": {
"ExpirationInDays": integer,
"GlacierJobTier": "BULK"|"STANDARD"
},
"S3PutObjectLegalHold": {
"LegalHold": {
"Status": "OFF"|"ON"
}
},
"S3PutObjectRetention": {
"BypassGovernanceRetention": true|false,
"Retention": {
"RetainUntilDate": timestamp,
"Mode": "COMPLIANCE"|"GOVERNANCE"
}
}
}
--report
(structure)
Configuration parameters for the optional job-completion report.
Bucket -> (string)
The Amazon Resource Name (ARN) for the bucket where specified job-completion report will be stored.
Format -> (string)
The format of the specified job-completion report.
Enabled -> (boolean)
Indicates whether the specified job will generate a job-completion report.
Prefix -> (string)
An optional prefix to describe where in the specified bucket the job-completion report will be stored. Amazon S3 will store the job-completion report at <prefix>/job-<job-id>/report.json.
ReportScope -> (string)
Indicates whether the job-completion report will include details of all tasks or only failed tasks.
Shorthand Syntax:
Bucket=string,Format=string,Enabled=boolean,Prefix=string,ReportScope=string
JSON Syntax:
{
"Bucket": "string",
"Format": "Report_CSV_20180820",
"Enabled": true|false,
"Prefix": "string",
"ReportScope": "AllTasks"|"FailedTasksOnly"
}
--client-request-token
(string)
An idempotency token to ensure that you don’t accidentally submit the same request twice. You can use any string up to the maximum length.
--manifest
(structure)
Configuration parameters for the manifest.
Spec -> (structure)
Describes the format of the specified job’s manifest. If the manifest is in CSV format, also describes the columns contained within the manifest.
Format -> (string)
Indicates which of the available formats the specified manifest uses.
Fields -> (list)
If the specified manifest object is in the
S3BatchOperations_CSV_20180820
format, this element describes which columns contain the required data.(string)
Location -> (structure)
Contains the information required to locate the specified job’s manifest.
ObjectArn -> (string)
The Amazon Resource Name (ARN) for a manifest object.
ObjectVersionId -> (string)
The optional version ID to identify a specific version of the manifest object.
ETag -> (string)
The ETag for the specified manifest object.
Shorthand Syntax:
Spec={Format=string,Fields=[string,string]},Location={ObjectArn=string,ObjectVersionId=string,ETag=string}
JSON Syntax:
{
"Spec": {
"Format": "S3BatchOperations_CSV_20180820"|"S3InventoryReport_CSV_20161130",
"Fields": ["Ignore"|"Bucket"|"Key"|"VersionId", ...]
},
"Location": {
"ObjectArn": "string",
"ObjectVersionId": "string",
"ETag": "string"
}
}
--description
(string)
A description for this job. You can use any string within the permitted length. Descriptions don’t need to be unique and can be used for multiple jobs.
--priority
(integer)
The numerical priority for this job. Higher numbers indicate higher priority.
--role-arn
(string)
The Amazon Resource Name (ARN) for the AWS Identity and Access Management (IAM) role that Batch Operations will use to execute this job’s operation on each object in the manifest.
--tags
(list)
A set of tags to associate with the Amazon S3 Batch Operations job. This is an optional parameter.
(structure)
Key -> (string)
Value -> (string)
Shorthand Syntax:
Key=string,Value=string ...
JSON Syntax:
[
{
"Key": "string",
"Value": "string"
}
...
]
--cli-input-json
| --cli-input-yaml
(string)
Reads arguments from the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton
. If other arguments are provided on the command line, those values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally. This may not be specified along with --cli-input-yaml
.
--generate-cli-skeleton
(string)
Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input
, prints a sample input JSON that can be used as an argument for --cli-input-json
. Similarly, if provided yaml-input
it will print a sample input YAML that can be used with --cli-input-yaml
. If provided with the value output
, it validates the command inputs and returns a sample output JSON for that command.
--cli-auto-prompt
(boolean)
Automatically prompt for CLI input parameters.
See ‘aws help’ for descriptions of global parameters.
To create an Amazon S3 batch operations job
The following create-job
example creates an Amazon S3 batch operations job to tag objects as confidential` in the bucket ``employee-records
.
aws s3control create-job \
--account-id 123456789012 \
--operation '{"S3PutObjectTagging": { "TagSet": [{"Key":"confidential", "Value":"true"}] }}' \
--report '{"Bucket":"arn:aws:s3:::employee-records-logs","Prefix":"batch-op-create-job", "Format":"Report_CSV_20180820","Enabled":true,"ReportScope":"AllTasks"}' \
--manifest '{"Spec":{"Format":"S3BatchOperations_CSV_20180820","Fields":["Bucket","Key"]},"Location":{"ObjectArn":"arn:aws:s3:::employee-records-logs/inv-report/7a6a9be4-072c-407e-85a2-ec3e982f773e.csv","ETag":"69f52a4e9f797e987155d9c8f5880897"}}' \
--priority 42 \
--role-arn arn:aws:iam::123456789012:role/S3BatchJobRole
Output:
{
"JobId": "93735294-df46-44d5-8638-6356f335324e"
}
JobId -> (string)
The ID for this job. Amazon S3 generates this ID automatically and returns it after a successful
Create Job
request.