Note: You are viewing the documentation for an older major version of the AWS CLI (version 1).

AWS CLI version 2, the latest major version of AWS CLI, is now stable and recommended for general use. To view this page for the AWS CLI version 2, click here. For more information see the AWS CLI version 2 installation instructions and migration guide.

[ aws . s3control ]

create-job

Description

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 .

This action creates a S3 Batch Operations job.

Related actions include:

See also: AWS API Documentation

See 'aws help' for descriptions of global parameters.

Synopsis

  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>]
[--manifest-generator <value>]
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]

Options

--account-id (string)

The Amazon Web Services account ID that creates the job.

--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 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 -> (structure)

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.

S3PutObjectCopy -> (structure)

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

TargetResource -> (string)

Specifies the destination bucket ARN for the batch copy operation. For example, to copy objects to a bucket named "destinationBucket", set the TargetResource to "arn:aws:s3:::destinationBucket".

CannedAccessControlList -> (string)

AccessControlGrants -> (list)

(structure)

Grantee -> (structure)

TypeIdentifier -> (string)

Identifier -> (string)

DisplayName -> (string)

Permission -> (string)

MetadataDirective -> (string)

ModifiedSinceConstraint -> (timestamp)

NewObjectMetadata -> (structure)

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 -> (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)

Specifies an optional metadata property for website redirects, x-amz-website-redirect-location . Allows webpage redirects if the object is accessed through a website endpoint.

RequesterPays -> (boolean)

StorageClass -> (string)

UnModifiedSinceConstraint -> (timestamp)

SSEAwsKmsKeyId -> (string)

TargetKeyPrefix -> (string)

Specifies the folder prefix into which you would like the objects to be copied. For example, to copy objects into a folder named Folder1 in the destination bucket, set the TargetKeyPrefix to Folder1 .

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 expires on all objects in the Batch Operations job.

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.

ChecksumAlgorithm -> (string)

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

S3PutObjectAcl -> (structure)

Directs the specified job to run a PUT Object acl call on every 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 run a PUT Object tagging call on every object in the manifest.

TagSet -> (list)

(structure)

Key -> (string)

Value -> (string)

S3DeleteObjectTagging -> (structure)

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

S3InitiateRestoreObject -> (structure)

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

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 -> (structure)

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

LegalHold -> (structure)

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

Status -> (string)

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

S3PutObjectRetention -> (structure)

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. For more information, see Using S3 Object Lock retention with S3 Batch Operations in the Amazon S3 User Guide .

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 -> (structure)

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 -> (timestamp)

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 -> (structure)

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

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"|"GLACIER_IR",
    "UnModifiedSinceConstraint": timestamp,
    "SSEAwsKmsKeyId": "string",
    "TargetKeyPrefix": "string",
    "ObjectLockLegalHoldStatus": "OFF"|"ON",
    "ObjectLockMode": "COMPLIANCE"|"GOVERNANCE",
    "ObjectLockRetainUntilDate": timestamp,
    "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": integer,
    "GlacierJobTier": "BULK"|"STANDARD"
  },
  "S3PutObjectLegalHold": {
    "LegalHold": {
      "Status": "OFF"|"ON"
    }
  },
  "S3PutObjectRetention": {
    "BypassGovernanceRetention": true|false,
    "Retention": {
      "RetainUntilDate": timestamp,
      "Mode": "COMPLIANCE"|"GOVERNANCE"
    }
  },
  "S3ReplicateObject": {

  }
}

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

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.

Warning

Replacement must be made for object keys containing special characters (such as carriage returns) when using XML requests. For more information, see XML related object key constraints .

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

(structure)

Key -> (string)

Value -> (string)

Shorthand Syntax:

Key=string,Value=string ...

JSON Syntax:

[
  {
    "Key": "string",
    "Value": "string"
  }
  ...
]

--manifest-generator (structure)

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

S3JobManifestGenerator -> (structure)

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)

The source bucket used by the ManifestGenerator.

ManifestOutputLocation -> (structure)

Specifies the location the generated manifest will be written to.

ExpectedManifestBucketOwner -> (string)

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

Bucket -> (string)

The bucket ARN the generated manifest should be written to.

ManifestPrefix -> (string)

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

ManifestEncryption -> (structure)

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

SSES3 -> (structure)

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

SSEKMS -> (structure)

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

KeyId -> (string)

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

ManifestFormat -> (string)

The format of the generated manifest.

Filter -> (structure)

Specifies rules the S3JobManifestGenerator should use to 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 -> (timestamp)

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

CreatedBefore -> (timestamp)

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

ObjectReplicationStatuses -> (list)

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

(string)

EnableManifestOutput -> (boolean)

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

JSON Syntax:

{
  "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": timestamp,
      "CreatedBefore": timestamp,
      "ObjectReplicationStatuses": ["COMPLETED"|"FAILED"|"REPLICA"|"NONE", ...]
    },
    "EnableManifestOutput": true|false
  }
}

--cli-input-json (string) Performs service operation based on the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, the CLI 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.

--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. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command.

See 'aws help' for descriptions of global parameters.

Examples

Note

To use the following examples, you must have the AWS CLI installed and configured. See the Getting started guide in the AWS CLI User Guide for more information.

Unless otherwise stated, all examples have unix-like quotation rules. These examples will need to be adapted to your terminal's quoting rules. See Using quotation marks with strings in the AWS CLI User Guide .

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"
}

Output

JobId -> (string)

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