StartTableMigration
Starts migrating an AWS Glue Data Catalog table into a new table in a table bucket. The migration runs asynchronously: this operation returns the migration ID and its initial state, and you track progress with GetTableMigration.
The namespace must already exist, and a table with the specified name must not. The migration creates the table during planning and commits data to it as it runs. Until you call CompleteTableMigration, you can read the table but you can't write to it. If the migration fails or is cancelled, the table and the data already committed to it remain.
The migration first checks the source and the destination, and writes the table compatibility and object compatibility reports to the bucket that you specify in migrationOutput. If you set reviewMigrationPlan to true, the migration waits in the pendingReview state so that you can review the reports, and continues only when you call UpdateTableMigration with requestedState set to queued. If you don't continue or cancel the migration within 30 days, the migration fails. Otherwise it continues to migrate the data, and writes the object migration report when the migration ends. If planning fails, the migration writes no object migration report.
- Permissions
-
-
You must have the
s3tables:StartTableMigrationpermission to use this operation. -
You must have the
iam:PassRolepermission on the role that you specify inroleARN, with a condition that allows passing it tomigration.s3tables.amazonaws.com. The associated resource is the table bucket. -
If
destinationTablespecifies SSE-KMS encryption, you must have thekms:DescribeKeyandkms:GenerateDataKeypermissions on the KMS key. You must also grant the S3 Tables maintenance principal access to the key. For more information, see Permissions requirements for S3 Tables SSE-KMS encryption.
-
Request Syntax
POST /start-table-migration HTTP/1.1
Content-type: application/json
{
"dataMigration": {
"maintenanceSettings": {
"icebergCompaction": {
"strategy": "string",
"targetFileSizeMB": number
},
"icebergSnapshotManagement": {
"maxSnapshotAgeHours": number,
"minSnapshotsToKeep": number
}
},
"migrationPolicies": {
"incompatibleValuesPolicy": "string",
"unmatchedSourceFieldsPolicy": "string"
}
},
"destinationTable": {
"encryptionConfiguration": {
"kmsKeyArn": "string",
"sseAlgorithm": "string"
},
"icebergSortOrder": {
"fields": [
{
"direction": "string",
"null-order": "string",
"source-id": number,
"transform": "string"
}
],
"order-id": number
},
"name": "string",
"namespace": "string",
"properties": {
"compressionCodec": "string",
"dictionaryEncoding": boolean,
"icebergFormatVersion": number,
"writeFormat": "string"
},
"schema": {
"fields": [
{
"doc": "string",
"id": number,
"name": "string",
"required": boolean,
"type": JSON value
}
],
"identifier-field-ids": [ number ],
"schema-id": number,
"type": "string"
},
"storageClassConfiguration": {
"storageClass": "string"
},
"tableBucketARN": "string",
"tags": {
"string" : "string"
}
},
"migrationOutput": {
"bucket": "string",
"prefixes": {
"objectCompatibilityReport": "string",
"objectMigrationReport": "string",
"tableCompatibilityReport": "string"
}
},
"reviewMigrationPlan": boolean,
"roleARN": "string",
"source": { ... },
"sourceType": "string"
}
URI Request Parameters
The request does not use any URI parameters.
Request Body
The request accepts the following data in JSON format.
- dataMigration
-
The maintenance settings and migration policies for the destination table.
Type: DataMigrationSettings object
Required: No
- destinationTable
-
The table to create and migrate the source into.
Type: DestinationTable object
Required: Yes
- migrationOutput
-
The bucket and prefixes that the migration writes its reports to. The bucket must be a general purpose bucket in your account and in the same Region as the table bucket, and the migration role must be able to write objects to it. Otherwise, the migration fails when it writes its first report.
Type: MigrationOutputConfiguration object
Required: Yes
- reviewMigrationPlan
-
Specifies whether the migration waits in the
pendingReviewstate, so that you can review the compatibility reports before it migrates any data. Iftrue, the migration continues when you callUpdateTableMigrationwithrequestedStateset toqueued. If you don't continue or cancel the migration within 30 days, the migration fails. The default isfalse.Type: Boolean
Required: No
- roleARN
-
The Amazon Resource Name (ARN) of the IAM role that the migration uses to read the source table and its data and to write the destination table and the reports. The role must be in your account, and its trust policy must allow
migration.s3tables.amazonaws.comto assume it. You can limit the trust policy to the destination table bucket with theaws:SourceArnandaws:SourceAccountcondition keys.Type: String
Length Constraints: Minimum length of 20. Maximum length of 2048.
Pattern:
arn:aws[-a-z0-9]*:iam::[0-9]{12}:role/.+Required: Yes
- source
-
The source table to migrate.
Type: SourceConfiguration object
Note: This object is a Union. Only one member of this object can be specified or returned.
Required: Yes
- sourceType
-
The type of the source. It must match the member that you set in
source.Type: String
Valid Values:
glueTableRequired: Yes
Response Syntax
HTTP/1.1 202
Content-type: application/json
{
"migrationId": "string",
"state": "string"
}
Response Elements
If the action is successful, the service sends back an HTTP 202 response.
The following data is returned in JSON format by the service.
- migrationId
-
The ID of the migration.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 64.
Pattern:
[a-z0-9-]+ - state
-
The state of the migration when the request is accepted, such as
planning.Type: String
Valid Values:
new | planning | pendingReview | queued | migrating | succeeded | failed | cancelling | cancelled
Errors
- AccessDeniedException
-
The action cannot be performed because you do not have the required permission.
HTTP Status Code: 403
- BadRequestException
-
The request is invalid or malformed.
HTTP Status Code: 400
- ConflictException
-
The request failed because there is a conflict with a previous write. You can retry the request.
HTTP Status Code: 409
- ForbiddenException
-
The caller isn't authorized to make the request.
HTTP Status Code: 403
- InternalServerErrorException
-
The request failed due to an internal server error.
HTTP Status Code: 500
- NotFoundException
-
The request was rejected because the specified resource could not be found.
HTTP Status Code: 404
- TooManyRequestsException
-
The limit on the number of requests per second was exceeded.
HTTP Status Code: 429
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: