

# CreateJob
<a name="API_control_CreateJob"></a>

This operation creates an S3 Batch Operations job.

You can use S3 Batch Operations to perform large-scale batch actions on Amazon S3 objects. Batch Operations can run a single action on lists of Amazon S3 objects that you specify. For more information, see [S3 Batch Operations](https://docs.amazonaws.cn/AmazonS3/latest/userguide/batch-ops.html) in the *Amazon S3 User Guide*.

Permissions  
For information about permissions required to use the Batch Operations, see [Granting permissions for S3 Batch Operations](https://docs.amazonaws.cn/AmazonS3/latest/userguide/batch-ops-iam-role-policies.html) in the *Amazon S3 User Guide*.



Related actions include:
+  [DescribeJob](https://docs.amazonaws.cn/AmazonS3/latest/API/API_control_DescribeJob.html) 
+  [ListJobs](https://docs.amazonaws.cn/AmazonS3/latest/API/API_control_ListJobs.html) 
+  [UpdateJobPriority](https://docs.amazonaws.cn/AmazonS3/latest/API/API_control_UpdateJobPriority.html) 
+  [UpdateJobStatus](https://docs.amazonaws.cn/AmazonS3/latest/API/API_control_UpdateJobStatus.html) 
+  [JobOperation](https://docs.amazonaws.cn/AmazonS3/latest/API/API_control_JobOperation.html) 

## Request Syntax
<a name="API_control_CreateJob_RequestSyntax"></a>

```
POST /v20180820/jobs HTTP/1.1
Host: s3-control.amazonaws.com.cn
x-amz-account-id: AccountId
<?xml version="1.0" encoding="UTF-8"?>
<CreateJobRequest xmlns="http://awss3control.amazonaws.com/doc/2018-08-20/">
   <ConfirmationRequired>boolean</ConfirmationRequired>
   <Operation>
      <LambdaInvoke>
         <FunctionArn>string</FunctionArn>
         <InvocationSchemaVersion>string</InvocationSchemaVersion>
         <UserArguments>
            <entry>
               <key>string</key>
               <value>string</value>
            </entry>
         </UserArguments>
      </LambdaInvoke>
      <S3ComputeObjectChecksum>
         <ChecksumAlgorithm>string</ChecksumAlgorithm>
         <ChecksumType>string</ChecksumType>
      </S3ComputeObjectChecksum>
      <S3DeleteObjectTagging>
      </S3DeleteObjectTagging>
      <S3InitiateRestoreObject>
         <ExpirationInDays>integer</ExpirationInDays>
         <GlacierJobTier>string</GlacierJobTier>
      </S3InitiateRestoreObject>
      <S3PutObjectAcl>
         <AccessControlPolicy>
            <AccessControlList>
               <Grants>
                  <S3Grant>
                     <Grantee>
                        <DisplayName>string</DisplayName>
                        <Identifier>string</Identifier>
                        <TypeIdentifier>string</TypeIdentifier>
                     </Grantee>
                     <Permission>string</Permission>
                  </S3Grant>
               </Grants>
               <Owner>
                  <DisplayName>string</DisplayName>
                  <ID>string</ID>
               </Owner>
            </AccessControlList>
            <CannedAccessControlList>string</CannedAccessControlList>
         </AccessControlPolicy>
      </S3PutObjectAcl>
      <S3PutObjectCopy>
         <AccessControlGrants>
            <S3Grant>
               <Grantee>
                  <DisplayName>string</DisplayName>
                  <Identifier>string</Identifier>
                  <TypeIdentifier>string</TypeIdentifier>
               </Grantee>
               <Permission>string</Permission>
            </S3Grant>
         </AccessControlGrants>
         <BucketKeyEnabled>boolean</BucketKeyEnabled>
         <CannedAccessControlList>string</CannedAccessControlList>
         <ChecksumAlgorithm>string</ChecksumAlgorithm>
         <MetadataDirective>string</MetadataDirective>
         <ModifiedSinceConstraint>timestamp</ModifiedSinceConstraint>
         <NewObjectMetadata>
            <CacheControl>string</CacheControl>
            <ContentDisposition>string</ContentDisposition>
            <ContentEncoding>string</ContentEncoding>
            <ContentLanguage>string</ContentLanguage>
            <ContentLength>long</ContentLength>
            <ContentMD5>string</ContentMD5>
            <ContentType>string</ContentType>
            <HttpExpiresDate>timestamp</HttpExpiresDate>
            <RequesterCharged>boolean</RequesterCharged>
            <SSEAlgorithm>string</SSEAlgorithm>
            <UserMetadata>
               <entry>
                  <key>string</key>
                  <value>string</value>
               </entry>
            </UserMetadata>
         </NewObjectMetadata>
         <NewObjectTagging>
            <S3Tag>
               <Key>string</Key>
               <Value>string</Value>
            </S3Tag>
         </NewObjectTagging>
         <ObjectLockLegalHoldStatus>string</ObjectLockLegalHoldStatus>
         <ObjectLockMode>string</ObjectLockMode>
         <ObjectLockRetainUntilDate>timestamp</ObjectLockRetainUntilDate>
         <RedirectLocation>string</RedirectLocation>
         <RequesterPays>boolean</RequesterPays>
         <SSEAwsKmsKeyId>string</SSEAwsKmsKeyId>
         <StorageClass>string</StorageClass>
         <TargetKeyPrefix>string</TargetKeyPrefix>
         <TargetResource>string</TargetResource>
         <UnModifiedSinceConstraint>timestamp</UnModifiedSinceConstraint>
      </S3PutObjectCopy>
      <S3PutObjectLegalHold>
         <LegalHold>
            <Status>string</Status>
         </LegalHold>
      </S3PutObjectLegalHold>
      <S3PutObjectRetention>
         <BypassGovernanceRetention>boolean</BypassGovernanceRetention>
         <Retention>
            <Mode>string</Mode>
            <RetainUntilDate>timestamp</RetainUntilDate>
         </Retention>
      </S3PutObjectRetention>
      <S3PutObjectTagging>
         <TagSet>
            <S3Tag>
               <Key>string</Key>
               <Value>string</Value>
            </S3Tag>
         </TagSet>
      </S3PutObjectTagging>
      <S3ReplicateObject>
      </S3ReplicateObject>
      <S3UpdateObjectEncryption>
         <ObjectEncryption>
            <SSE-KMS>
               <BucketKeyEnabled>boolean</BucketKeyEnabled>
               <KMSKeyArn>string</KMSKeyArn>
            </SSE-KMS>
         </ObjectEncryption>
      </S3UpdateObjectEncryption>
   </Operation>
   <Report>
      <Bucket>string</Bucket>
      <Enabled>boolean</Enabled>
      <ExpectedBucketOwner>string</ExpectedBucketOwner>
      <Format>string</Format>
      <Prefix>string</Prefix>
      <ReportScope>string</ReportScope>
   </Report>
   <ClientRequestToken>string</ClientRequestToken>
   <Manifest>
      <Location>
         <ETag>string</ETag>
         <ObjectArn>string</ObjectArn>
         <ObjectVersionId>string</ObjectVersionId>
      </Location>
      <Spec>
         <Fields>
            <member>string</member>
         </Fields>
         <Format>string</Format>
      </Spec>
   </Manifest>
   <Description>string</Description>
   <Priority>integer</Priority>
   <RoleArn>string</RoleArn>
   <Tags>
      <S3Tag>
         <Key>string</Key>
         <Value>string</Value>
      </S3Tag>
   </Tags>
   <ManifestGenerator>
      <S3JobManifestGenerator>
         <EnableManifestOutput>boolean</EnableManifestOutput>
         <ExpectedBucketOwner>string</ExpectedBucketOwner>
         <Filter>
            <CreatedAfter>timestamp</CreatedAfter>
            <CreatedBefore>timestamp</CreatedBefore>
            <EligibleForReplication>boolean</EligibleForReplication>
            <KeyNameConstraint>
               <MatchAnyPrefix>
                  <member>string</member>
               </MatchAnyPrefix>
               <MatchAnySubstring>
                  <member>string</member>
               </MatchAnySubstring>
               <MatchAnySuffix>
                  <member>string</member>
               </MatchAnySuffix>
            </KeyNameConstraint>
            <MatchAnyObjectEncryption>
               <ObjectEncryption>
                  <DSSE-KMS>
                     <KmsKeyArn>string</KmsKeyArn>
                  </DSSE-KMS>
                  <NOT-SSE>
                  </NOT-SSE>
                  <SSE-C>
                  </SSE-C>
                  <SSE-KMS>
                     <BucketKeyEnabled>boolean</BucketKeyEnabled>
                     <KmsKeyArn>string</KmsKeyArn>
                  </SSE-KMS>
                  <SSE-S3>
                  </SSE-S3>
               </ObjectEncryption>
            </MatchAnyObjectEncryption>
            <MatchAnyStorageClass>
               <member>string</member>
            </MatchAnyStorageClass>
            <ObjectReplicationStatuses>
               <member>string</member>
            </ObjectReplicationStatuses>
            <ObjectSizeGreaterThanBytes>long</ObjectSizeGreaterThanBytes>
            <ObjectSizeLessThanBytes>long</ObjectSizeLessThanBytes>
         </Filter>
         <ManifestOutputLocation>
            <Bucket>string</Bucket>
            <ExpectedManifestBucketOwner>string</ExpectedManifestBucketOwner>
            <ManifestEncryption>
               <SSE-KMS>
                  <KeyId>string</KeyId>
               </SSE-KMS>
               <SSE-S3>
               </SSE-S3>
            </ManifestEncryption>
            <ManifestFormat>string</ManifestFormat>
            <ManifestPrefix>string</ManifestPrefix>
         </ManifestOutputLocation>
         <SourceBucket>string</SourceBucket>
      </S3JobManifestGenerator>
   </ManifestGenerator>
</CreateJobRequest>
```

## URI Request Parameters
<a name="API_control_CreateJob_RequestParameters"></a>

The request uses the following URI parameters.

 ** [x-amz-account-id](#API_control_CreateJob_RequestSyntax) **   <a name="AmazonS3-control_CreateJob-request-header-AccountId"></a>
The Amazon Web Services account ID that creates the job.  
Length Constraints: Maximum length of 64.  
Pattern: `^\d{12}$`   
Required: Yes

## Request Body
<a name="API_control_CreateJob_RequestBody"></a>

The request accepts the following data in XML format.

 ** [CreateJobRequest](#API_control_CreateJob_RequestSyntax) **   <a name="AmazonS3-control_CreateJob-request-CreateJobRequest"></a>
Root level tag for the CreateJobRequest parameters.  
Required: Yes

 ** [ClientRequestToken](#API_control_CreateJob_RequestSyntax) **   <a name="AmazonS3-control_CreateJob-request-ClientRequestToken"></a>
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.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 64.  
Required: Yes

 ** [ConfirmationRequired](#API_control_CreateJob_RequestSyntax) **   <a name="AmazonS3-control_CreateJob-request-ConfirmationRequired"></a>
Indicates whether confirmation is required before Amazon S3 runs the job. Confirmation is only required for jobs created through the Amazon S3 console.  
Type: Boolean  
Required: No

 ** [Description](#API_control_CreateJob_RequestSyntax) **   <a name="AmazonS3-control_CreateJob-request-Description"></a>
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.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 256.  
Required: No

 ** [Manifest](#API_control_CreateJob_RequestSyntax) **   <a name="AmazonS3-control_CreateJob-request-Manifest"></a>
Configuration parameters for the manifest.  
Type: [JobManifest](API_control_JobManifest.md) data type  
Required: No

 ** [ManifestGenerator](#API_control_CreateJob_RequestSyntax) **   <a name="AmazonS3-control_CreateJob-request-ManifestGenerator"></a>
The attribute container for the ManifestGenerator details. Jobs must be created with either a manifest file or a ManifestGenerator, but not both.  
Type: [JobManifestGenerator](API_control_JobManifestGenerator.md) data type  
 **Note: **This object is a Union. Only one member of this object can be specified or returned.  
Required: No

 ** [Operation](#API_control_CreateJob_RequestSyntax) **   <a name="AmazonS3-control_CreateJob-request-Operation"></a>
The action that you want this job to perform on every object listed in the manifest. For more information about the available actions, see [Operations](https://docs.amazonaws.cn/AmazonS3/latest/dev/batch-ops-operations.html) in the *Amazon S3 User Guide*.  
Type: [JobOperation](API_control_JobOperation.md) data type  
Required: Yes

 ** [Priority](#API_control_CreateJob_RequestSyntax) **   <a name="AmazonS3-control_CreateJob-request-Priority"></a>
The numerical priority for this job. Higher numbers indicate higher priority.  
Type: Integer  
Valid Range: Minimum value of 0. Maximum value of 2147483647.  
Required: Yes

 ** [Report](#API_control_CreateJob_RequestSyntax) **   <a name="AmazonS3-control_CreateJob-request-Report"></a>
Configuration parameters for the optional job-completion report.  
Type: [JobReport](API_control_JobReport.md) data type  
Required: Yes

 ** [RoleArn](#API_control_CreateJob_RequestSyntax) **   <a name="AmazonS3-control_CreateJob-request-RoleArn"></a>
The Amazon Resource Name (ARN) for the Amazon Identity and Access Management (IAM) role that Batch Operations will use to run this job's action on every object in the manifest.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Pattern: `arn:[^:]+:iam::\d{12}:role/.*`   
Required: Yes

 ** [Tags](#API_control_CreateJob_RequestSyntax) **   <a name="AmazonS3-control_CreateJob-request-Tags"></a>
A set of tags to associate with the S3 Batch Operations job. This is an optional parameter.   
Type: Array of [S3Tag](API_control_S3Tag.md) data types  
Required: No

## Response Syntax
<a name="API_control_CreateJob_ResponseSyntax"></a>

```
HTTP/1.1 200
<?xml version="1.0" encoding="UTF-8"?>
<CreateJobResult>
   <JobId>string</JobId>
</CreateJobResult>
```

## Response Elements
<a name="API_control_CreateJob_ResponseElements"></a>

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in XML format by the service.

 ** [CreateJobResult](#API_control_CreateJob_ResponseSyntax) **   <a name="AmazonS3-control_CreateJob-response-CreateJobResult"></a>
Root level tag for the CreateJobResult parameters.  
Required: Yes

 ** [JobId](#API_control_CreateJob_ResponseSyntax) **   <a name="AmazonS3-control_CreateJob-response-JobId"></a>
The ID for this job. Amazon S3 generates this ID automatically and returns it after a successful `Create Job` request.  
Type: String  
Length Constraints: Minimum length of 5. Maximum length of 36.  
Pattern: `[a-zA-Z0-9\-\_]+` 

## Errors
<a name="API_control_CreateJob_Errors"></a>

 ** BadRequestException **   
  
HTTP Status Code: 400

 ** IdempotencyException **   
  
HTTP Status Code: 400

 ** InternalServiceException **   
  
HTTP Status Code: 500

 ** TooManyRequestsException **   
  
HTTP Status Code: 400

## See Also
<a name="API_control_CreateJob_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/s3control-2018-08-20/CreateJob) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/s3control-2018-08-20/CreateJob) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/s3control-2018-08-20/CreateJob) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/s3control-2018-08-20/CreateJob) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/s3control-2018-08-20/CreateJob) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/s3control-2018-08-20/CreateJob) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/s3control-2018-08-20/CreateJob) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/s3control-2018-08-20/CreateJob) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/s3control-2018-08-20/CreateJob) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/s3control-2018-08-20/CreateJob) 