S3Control / Client / create_job

create_job#

S3Control.Client.create_job(**kwargs)#

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 in the Amazon S3 User Guide.

Permissions

For information about permissions required to use the Batch Operations, see Granting permissions for S3 Batch Operations in the Amazon S3 User Guide.

Related actions include:

See also: AWS API Documentation

Request Syntax

response = client.create_job(
    AccountId='string',
    ConfirmationRequired=True|False,
    Operation={
        'LambdaInvoke': {
            'FunctionArn': 'string',
            'InvocationSchemaVersion': 'string',
            'UserArguments': {
                'string': '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': datetime(2015, 1, 1),
            'NewObjectMetadata': {
                'CacheControl': 'string',
                'ContentDisposition': 'string',
                'ContentEncoding': 'string',
                'ContentLanguage': 'string',
                'UserMetadata': {
                    'string': 'string'
                },
                'ContentLength': 123,
                'ContentMD5': 'string',
                'ContentType': 'string',
                'HttpExpiresDate': datetime(2015, 1, 1),
                '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'|'GLACIER_IR',
            'UnModifiedSinceConstraint': datetime(2015, 1, 1),
            'SSEAwsKmsKeyId': 'string',
            'TargetKeyPrefix': 'string',
            'ObjectLockLegalHoldStatus': 'OFF'|'ON',
            'ObjectLockMode': 'COMPLIANCE'|'GOVERNANCE',
            'ObjectLockRetainUntilDate': datetime(2015, 1, 1),
            'BucketKeyEnabled': True|False,
            'ChecksumAlgorithm': 'CRC32'|'CRC32C'|'SHA1'|'SHA256'
        },
        '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'
                },
            ]
        },
        'S3DeleteObjectTagging': {}
        ,
        'S3InitiateRestoreObject': {
            'ExpirationInDays': 123,
            'GlacierJobTier': 'BULK'|'STANDARD'
        },
        'S3PutObjectLegalHold': {
            'LegalHold': {
                'Status': 'OFF'|'ON'
            }
        },
        'S3PutObjectRetention': {
            'BypassGovernanceRetention': True|False,
            'Retention': {
                'RetainUntilDate': datetime(2015, 1, 1),
                'Mode': 'COMPLIANCE'|'GOVERNANCE'
            }
        },
        'S3ReplicateObject': {}

    },
    Report={
        'Bucket': 'string',
        'Format': 'Report_CSV_20180820',
        'Enabled': True|False,
        'Prefix': 'string',
        'ReportScope': 'AllTasks'|'FailedTasksOnly'
    },
    ClientRequestToken='string',
    Manifest={
        'Spec': {
            'Format': 'S3BatchOperations_CSV_20180820'|'S3InventoryReport_CSV_20161130',
            'Fields': [
                'Ignore'|'Bucket'|'Key'|'VersionId',
            ]
        },
        'Location': {
            'ObjectArn': 'string',
            'ObjectVersionId': 'string',
            'ETag': 'string'
        }
    },
    Description='string',
    Priority=123,
    RoleArn='string',
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ],
    ManifestGenerator={
        'S3JobManifestGenerator': {
            'ExpectedBucketOwner': 'string',
            'SourceBucket': 'string',
            'ManifestOutputLocation': {
                'ExpectedManifestBucketOwner': 'string',
                'Bucket': 'string',
                'ManifestPrefix': 'string',
                'ManifestEncryption': {
                    'SSES3': {}
                    ,
                    'SSEKMS': {
                        'KeyId': 'string'
                    }
                },
                'ManifestFormat': 'S3InventoryReport_CSV_20211130'
            },
            'Filter': {
                'EligibleForReplication': True|False,
                'CreatedAfter': datetime(2015, 1, 1),
                'CreatedBefore': datetime(2015, 1, 1),
                'ObjectReplicationStatuses': [
                    'COMPLETED'|'FAILED'|'REPLICA'|'NONE',
                ],
                'KeyNameConstraint': {
                    'MatchAnyPrefix': [
                        'string',
                    ],
                    'MatchAnySuffix': [
                        'string',
                    ],
                    'MatchAnySubstring': [
                        'string',
                    ]
                },
                'ObjectSizeGreaterThanBytes': 123,
                'ObjectSizeLessThanBytes': 123,
                'MatchAnyStorageClass': [
                    'STANDARD'|'STANDARD_IA'|'ONEZONE_IA'|'GLACIER'|'INTELLIGENT_TIERING'|'DEEP_ARCHIVE'|'GLACIER_IR',
                ]
            },
            'EnableManifestOutput': True|False
        }
    }
)
Parameters:
  • AccountId (string) –

    [REQUIRED]

    The Amazon Web Services account ID that creates the job.

  • ConfirmationRequired (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 (dict) –

    [REQUIRED]

    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 in the Amazon S3 User Guide.

    • LambdaInvoke (dict) –

      Directs the specified job to invoke an Lambda function on every object in the manifest.

      • FunctionArn (string) –

        The Amazon Resource Name (ARN) for the Lambda function that the specified job will invoke on every object in the manifest.

      • InvocationSchemaVersion (string) –

        Specifies the schema version for the payload that Batch Operations sends when invoking an Lambda function. Version 1.0 is the default. Version 2.0 is required when you use Batch Operations to invoke Lambda functions that act on directory buckets, or if you need to specify UserArguments. For more information, see Using Lambda with Amazon S3 Batch Operations and Amazon S3 Express One Zone in the Amazon Web Services Storage Blog.

        Warning

        Ensure that your Lambda function code expects InvocationSchemaVersion 2.0 and uses bucket name rather than bucket ARN. If the InvocationSchemaVersion does not match what your Lambda function expects, your function might not work as expected.

        Note

        Directory buckets - To initiate Amazon Web Services Lambda function to perform custom actions on objects in directory buckets, you must specify 2.0.

      • UserArguments (dict) –

        Key-value pairs that are passed in the payload that Batch Operations sends when invoking an Lambda function. You must specify InvocationSchemaVersion 2.0 for LambdaInvoke operations that include UserArguments. For more information, see Using Lambda with Amazon S3 Batch Operations and Amazon S3 Express One Zone in the Amazon Web Services Storage Blog.

        • (string) –

          • (string) –

    • S3PutObjectCopy (dict) –

      Directs the specified job to run a PUT Copy object call on every object in the manifest.

      • TargetResource (string) –

        Specifies the destination bucket Amazon Resource Name (ARN) for the batch copy operation.

        • General purpose buckets - For example, to copy objects to a general purpose bucket named destinationBucket, set the TargetResource property to arn:aws:s3:::destinationBucket.

        • Directory buckets - For example, to copy objects to a directory bucket named destinationBucket in the Availability Zone; identified by the AZ ID usw2-az2, set the TargetResource property to arn:aws:s3express:region:account_id:/bucket/destination_bucket_base_name--usw2-az2--x-s3.

      • CannedAccessControlList (string) –

        Note

        This functionality is not supported by directory buckets.

      • AccessControlGrants (list) –

        Note

        This functionality is not supported by directory buckets.

        • (dict) –

          • Grantee (dict) –

            • TypeIdentifier (string) –

            • Identifier (string) –

            • DisplayName (string) –

          • Permission (string) –

      • MetadataDirective (string) –

      • ModifiedSinceConstraint (datetime) –

      • NewObjectMetadata (dict) –

        If you don’t provide this parameter, Amazon S3 copies all the metadata from the original objects. If you specify an empty set, the new objects will have no tags. Otherwise, Amazon S3 assigns the supplied tags to the new objects.

        • CacheControl (string) –

        • ContentDisposition (string) –

        • ContentEncoding (string) –

        • ContentLanguage (string) –

        • UserMetadata (dict) –

          • (string) –

            • (string) –

        • ContentLength (integer) –

          This member has been deprecated.

        • ContentMD5 (string) –

          This member has been deprecated.

        • ContentType (string) –

        • HttpExpiresDate (datetime) –

        • RequesterCharged (boolean) –

          This member has been deprecated.

        • SSEAlgorithm (string) –

          Note

          For directory buckets, only the server-side encryption with Amazon S3 managed keys (SSE-S3) ( AES256) is supported.

      • NewObjectTagging (list) –

        Specifies a list of tags to add to the destination objects after they are copied. If NewObjectTagging is not specified, the tags of the source objects are copied to destination objects by default.

        Note

        Directory buckets - Tags aren’t supported by directory buckets. If your source objects have tags and your destination bucket is a directory bucket, specify an empty tag set in the NewObjectTagging field to prevent copying the source object tags to the directory bucket.

        • (dict) –

          A container for a key-value name pair.

          • Key (string) – [REQUIRED]

            Key of the tag

          • Value (string) – [REQUIRED]

            Value of the tag

      • RedirectLocation (string) –

        If the destination bucket is configured as a website, specifies an optional metadata property for website redirects, x-amz-website-redirect-location. Allows webpage redirects if the object copy is accessed through a website endpoint.

        Note

        This functionality is not supported by directory buckets.

      • RequesterPays (boolean) –

        Note

        This functionality is not supported by directory buckets.

      • StorageClass (string) –

        Specify the storage class for the destination objects in a Copy operation.

        Note

        Directory buckets - This functionality is not supported by directory buckets.

      • UnModifiedSinceConstraint (datetime) –

      • SSEAwsKmsKeyId (string) –

        Note

        This functionality is not supported by directory buckets.

      • TargetKeyPrefix (string) –

        Specifies the folder prefix that you want the objects to be copied into. For example, to copy objects into a folder named Folder1 in the destination bucket, set the TargetKeyPrefix property to Folder1.

      • ObjectLockLegalHoldStatus (string) –

        The legal hold status to be applied to all objects in the Batch Operations job.

        Note

        This functionality is not supported by directory buckets.

      • ObjectLockMode (string) –

        The retention mode to be applied to all objects in the Batch Operations job.

        Note

        This functionality is not supported by directory buckets.

      • ObjectLockRetainUntilDate (datetime) –

        The date when the applied object retention configuration expires on all objects in the Batch Operations job.

        Note

        This functionality is not supported by directory buckets.

      • BucketKeyEnabled (boolean) –

        Specifies whether Amazon S3 should use an S3 Bucket Key for object encryption with server-side encryption using Amazon Web Services KMS (SSE-KMS). Setting this header to true causes Amazon S3 to use an S3 Bucket Key for object encryption with SSE-KMS.

        Specifying this header with an object action doesn’t affect bucket-level settings for S3 Bucket Key.

        Note

        This functionality is not supported by directory buckets.

      • ChecksumAlgorithm (string) –

        Indicates the algorithm that you want Amazon S3 to use to create the checksum. For more information, see Checking object integrity in the Amazon S3 User Guide.

    • S3PutObjectAcl (dict) –

      Directs the specified job to run a PutObjectAcl call on every object in the manifest.

      Note

      This functionality is not supported by directory buckets.

      • AccessControlPolicy (dict) –

        • AccessControlList (dict) –

          • Owner (dict) – [REQUIRED]

            • ID (string) –

            • DisplayName (string) –

          • Grants (list) –

            • (dict) –

              • Grantee (dict) –

                • TypeIdentifier (string) –

                • Identifier (string) –

                • DisplayName (string) –

              • Permission (string) –

        • CannedAccessControlList (string) –

    • S3PutObjectTagging (dict) –

      Directs the specified job to run a PUT Object tagging call on every object in the manifest.

      Note

      This functionality is not supported by directory buckets.

      • TagSet (list) –

        • (dict) –

          A container for a key-value name pair.

          • Key (string) – [REQUIRED]

            Key of the tag

          • Value (string) – [REQUIRED]

            Value of the tag

    • S3DeleteObjectTagging (dict) –

      Directs the specified job to execute a DELETE Object tagging call on every object in the manifest.

      Note

      This functionality is not supported by directory buckets.

    • S3InitiateRestoreObject (dict) –

      Directs the specified job to initiate restore requests for every archived object in the manifest.

      Note

      This functionality is not supported by directory buckets.

      • ExpirationInDays (integer) –

        This argument specifies how long the S3 Glacier or S3 Glacier Deep Archive object remains available in Amazon S3. S3 Initiate Restore Object jobs that target S3 Glacier and S3 Glacier Deep Archive objects require ExpirationInDays set to 1 or greater.

        Conversely, do not set ExpirationInDays when creating S3 Initiate Restore Object jobs that target S3 Intelligent-Tiering Archive Access and Deep Archive Access tier objects. Objects in S3 Intelligent-Tiering archive access tiers are not subject to restore expiry, so specifying ExpirationInDays results in restore request failure.

        S3 Batch Operations jobs can operate either on S3 Glacier and S3 Glacier Deep Archive storage class objects or on S3 Intelligent-Tiering Archive Access and Deep Archive Access storage tier objects, but not both types in the same job. If you need to restore objects of both types you must create separate Batch Operations jobs.

      • GlacierJobTier (string) –

        S3 Batch Operations supports STANDARD and BULK retrieval tiers, but not the EXPEDITED retrieval tier.

    • S3PutObjectLegalHold (dict) –

      Contains the configuration for an S3 Object Lock legal hold operation that an S3 Batch Operations job passes to every object to the underlying PutObjectLegalHold API operation. For more information, see Using S3 Object Lock legal hold with S3 Batch Operations in the Amazon S3 User Guide.

      Note

      This functionality is not supported by directory buckets.

      • LegalHold (dict) – [REQUIRED]

        Contains the Object Lock legal hold status to be applied to all objects in the Batch Operations job.

        • Status (string) – [REQUIRED]

          The Object Lock legal hold status to be applied to all objects in the Batch Operations job.

    • S3PutObjectRetention (dict) –

      Contains the configuration parameters for the Object Lock retention action for an S3 Batch Operations job. Batch Operations passes every object to the underlying PutObjectRetention API operation. For more information, see Using S3 Object Lock retention with S3 Batch Operations in the Amazon S3 User Guide.

      Note

      This functionality is not supported by directory buckets.

      • BypassGovernanceRetention (boolean) –

        Indicates if the action should be applied to objects in the Batch Operations job even if they have Object Lock GOVERNANCE type in place.

      • Retention (dict) – [REQUIRED]

        Contains the Object Lock retention mode to be applied to all objects in the Batch Operations job. For more information, see Using S3 Object Lock retention with S3 Batch Operations in the Amazon S3 User Guide.

        • RetainUntilDate (datetime) –

          The date when the applied Object Lock retention will expire on all objects set by the Batch Operations job.

        • Mode (string) –

          The Object Lock retention mode to be applied to all objects in the Batch Operations job.

    • S3ReplicateObject (dict) –

      Directs the specified job to invoke ReplicateObject on every object in the job’s manifest.

      Note

      This functionality is not supported by directory buckets.

  • Report (dict) –

    [REQUIRED]

    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.

      Note

      Directory buckets - Directory buckets aren’t supported as a location for Batch Operations to store job completion reports.

    • Format (string) –

      The format of the specified job-completion report.

    • Enabled (boolean) – [REQUIRED]

      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 stores 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.

  • ClientRequestToken (string) –

    [REQUIRED]

    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.

    This field is autopopulated if not provided.

  • Manifest (dict) –

    Configuration parameters for the manifest.

    • Spec (dict) – [REQUIRED]

      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) – [REQUIRED]

        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 (dict) – [REQUIRED]

      Contains the information required to locate the specified job’s manifest. Manifests can’t be imported from directory buckets. For more information, see Directory buckets.

      • ObjectArn (string) – [REQUIRED]

        The Amazon Resource Name (ARN) for a manifest object.

        Warning

        When you’re using XML requests, you must replace special characters (such as carriage returns) in object keys with their equivalent XML entity codes. For more information, see XML-related object key constraints in the Amazon S3 User Guide.

      • ObjectVersionId (string) –

        The optional version ID to identify a specific version of the manifest object.

      • ETag (string) – [REQUIRED]

        The ETag for the specified manifest object.

  • 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) –

    [REQUIRED]

    The numerical priority for this job. Higher numbers indicate higher priority.

  • RoleArn (string) –

    [REQUIRED]

    The Amazon Resource Name (ARN) for the Identity and Access Management (IAM) role that Batch Operations will use to run this job’s action on every object in the manifest.

  • Tags (list) –

    A set of tags to associate with the S3 Batch Operations job. This is an optional parameter.

    • (dict) –

      A container for a key-value name pair.

      • Key (string) – [REQUIRED]

        Key of the tag

      • Value (string) – [REQUIRED]

        Value of the tag

  • ManifestGenerator (dict) –

    The attribute container for the ManifestGenerator details. Jobs must be created with either a manifest file or a ManifestGenerator, but not both.

    Note

    This is a Tagged Union structure. Only one of the following top level keys can be set: S3JobManifestGenerator.

    • S3JobManifestGenerator (dict) –

      The S3 job ManifestGenerator’s configuration details.

      • ExpectedBucketOwner (string) –

        The Amazon Web Services account ID that owns the bucket the generated manifest is written to. If provided the generated manifest bucket’s owner Amazon Web Services account ID must match this value, else the job fails.

      • SourceBucket (string) – [REQUIRED]

        The source bucket used by the ManifestGenerator.

        Note

        Directory buckets - Directory buckets aren’t supported as the source buckets used by S3JobManifestGenerator to generate the job manifest.

      • ManifestOutputLocation (dict) –

        Specifies the location the generated manifest will be written to. Manifests can’t be written to directory buckets. For more information, see Directory buckets.

        • ExpectedManifestBucketOwner (string) –

          The Account ID that owns the bucket the generated manifest is written to.

        • Bucket (string) – [REQUIRED]

          The bucket ARN the generated manifest should be written to.

          Note

          Directory buckets - Directory buckets aren’t supported as the buckets to store the generated manifest.

        • ManifestPrefix (string) –

          Prefix identifying one or more objects to which the manifest applies.

        • ManifestEncryption (dict) –

          Specifies what encryption should be used when the generated manifest objects are written.

          • SSES3 (dict) –

            Specifies the use of SSE-S3 to encrypt generated manifest objects.

          • SSEKMS (dict) –

            Configuration details on how SSE-KMS is used to encrypt generated manifest objects.

            • KeyId (string) – [REQUIRED]

              Specifies the ID of the Amazon Web Services Key Management Service (Amazon Web Services KMS) symmetric encryption customer managed key to use for encrypting generated manifest objects.

        • ManifestFormat (string) – [REQUIRED]

          The format of the generated manifest.

      • Filter (dict) –

        Specifies rules the S3JobManifestGenerator should use to decide whether an object in the source bucket should or should not be included in the generated job manifest.

        • EligibleForReplication (boolean) –

          Include objects in the generated manifest only if they are eligible for replication according to the Replication configuration on the source bucket.

        • CreatedAfter (datetime) –

          If provided, the generated manifest includes only source bucket objects that were created after this time.

        • CreatedBefore (datetime) –

          If provided, the generated manifest includes only source bucket objects that were created before this time.

        • ObjectReplicationStatuses (list) –

          If provided, the generated manifest includes only source bucket objects that have one of the specified Replication statuses.

          • (string) –

        • KeyNameConstraint (dict) –

          If provided, the generated manifest includes only source bucket objects whose object keys match the string constraints specified for MatchAnyPrefix, MatchAnySuffix, and MatchAnySubstring.

          • MatchAnyPrefix (list) –

            If provided, the generated manifest includes objects where the specified string appears at the start of the object key string.

            • (string) –

          • MatchAnySuffix (list) –

            If provided, the generated manifest includes objects where the specified string appears at the end of the object key string.

            • (string) –

          • MatchAnySubstring (list) –

            If provided, the generated manifest includes objects where the specified string appears anywhere within the object key string.

            • (string) –

        • ObjectSizeGreaterThanBytes (integer) –

          If provided, the generated manifest includes only source bucket objects whose file size is greater than the specified number of bytes.

        • ObjectSizeLessThanBytes (integer) –

          If provided, the generated manifest includes only source bucket objects whose file size is less than the specified number of bytes.

        • MatchAnyStorageClass (list) –

          If provided, the generated manifest includes only source bucket objects that are stored with the specified storage class.

          • (string) –

      • EnableManifestOutput (boolean) – [REQUIRED]

        Determines whether or not to write the job’s generated manifest to a bucket.

Return type:

dict

Returns:

Response Syntax

{
    'JobId': 'string'
}

Response Structure

  • (dict) –

    • JobId (string) –

      The ID for this job. Amazon S3 generates this ID automatically and returns it after a successful Create Job request.

Exceptions

  • S3Control.Client.exceptions.TooManyRequestsException

  • S3Control.Client.exceptions.BadRequestException

  • S3Control.Client.exceptions.IdempotencyException

  • S3Control.Client.exceptions.InternalServiceException