S3PutObjectCopy - CreateJob operation: Request invalid

2

The goal here is to, using the AWS CLI, automate restoring objects back from Deep Archive and copying them back to INTELLIGENT_TIERING. I have the first part working, I create and upload a CSV to a bucket and then create a Batch Operation job to restore the objects. The plan is to at the same time create the COPY job using the same CSV file, but wait with submitting it until all the objects have been restored. But when I attempt to create the COPY job I get the error:

An error occurred (InvalidRequest) when calling the CreateJob operation: Request invalid

Here is my command:

aws s3control create-job --account-id <account id> --operation '{
  "S3PutObjectCopy": {
    "TargetResource": "arn:aws:s3:::<my target bucket>",
    "MetadataDirective": "COPY",
    "StorageClass": "INTELLIGENT_TIERING",
    "BucketKeyEnabled": false
  }
}' --manifest '{
  "Spec": {
    "Format": "S3BatchOperations_CSV_20180820",
    "Fields": [
      "Bucket",
      "Key",
      "TargetBucket",
      "TargetKey"
    ]
  },
  "Location": {
    "ObjectArn": "arn:aws:s3:::bucket/restores/manifests/restore-objects.csv",
    "ETag": "<etag>"
  }
}' --role-arn arn:aws:iam::<account id>:role/restore-copy-role --client-request-token 90cd761a-7eb5-4fc8-b9c0-9529db297442 --report '{
  "Bucket": "arn:aws:s3:::report-bucket",
  "Format": "Report_CSV_20180820",
  "Enabled": true,
  "Prefix": "restores/reports",
  "ReportScope": "AllTasks"
}' --priority 1 --region us-east-1 --confirmation-required --tags Key=Role,Value=restore-data Key=Project,Value=myprojectname 'Key=Project Number,Value=12345' 'Key=Data Type,Value=mydatatype'

This is identical to the RESTORE job, which it is able to create fine, apart from the operation, which looks like this:

{
  "S3InitiateRestoreObject": {
    "ExpirationInDays": 7,
    "GlacierJobTier": "BULK"
  }
}

The idea is that both jobs gets created one after the other, then something monitors at the restore job and when all the objects have been successfully restored, the copy job starts. Any ideas or suggestions are welcome.

Mattias
asked 18 days ago133 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions