/
RestoreDBClusterFromS3Command.ts
473 lines (462 loc) · 19.1 KB
/
RestoreDBClusterFromS3Command.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
// smithy-typescript generated code
import { EndpointParameterInstructions, getEndpointPlugin } from "@aws-sdk/middleware-endpoint";
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
import { Command as $Command } from "@aws-sdk/smithy-client";
import {
FinalizeHandlerArguments,
Handler,
HandlerExecutionContext,
HttpHandlerOptions as __HttpHandlerOptions,
MetadataBearer as __MetadataBearer,
MiddlewareStack,
SerdeContext as __SerdeContext,
} from "@aws-sdk/types";
import { RestoreDBClusterFromS3Message, RestoreDBClusterFromS3Result } from "../models/models_1";
import { de_RestoreDBClusterFromS3Command, se_RestoreDBClusterFromS3Command } from "../protocols/Aws_query";
import { RDSClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RDSClient";
/**
* @public
*
* The input for {@link RestoreDBClusterFromS3Command}.
*/
export interface RestoreDBClusterFromS3CommandInput extends RestoreDBClusterFromS3Message {}
/**
* @public
*
* The output of {@link RestoreDBClusterFromS3Command}.
*/
export interface RestoreDBClusterFromS3CommandOutput extends RestoreDBClusterFromS3Result, __MetadataBearer {}
/**
* @public
* <p>Creates an Amazon Aurora DB cluster from MySQL data stored in an Amazon S3 bucket.
* Amazon RDS must be authorized to access the Amazon S3 bucket and the data must be
* created using the Percona XtraBackup utility as described in <a href="https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Migrating.ExtMySQL.html#AuroraMySQL.Migrating.ExtMySQL.S3"> Migrating Data from MySQL by Using an Amazon S3 Bucket</a> in the
* <i>Amazon Aurora User Guide</i>.</p>
* <note>
* <p>This action only restores the DB cluster, not the DB instances for that DB
* cluster. You must invoke the <code>CreateDBInstance</code> action to create DB
* instances for the restored DB cluster, specifying the identifier of the restored DB
* cluster in <code>DBClusterIdentifier</code>. You can create DB instances only after
* the <code>RestoreDBClusterFromS3</code> action has completed and the DB
* cluster is available.</p>
* </note>
* <p>For more information on Amazon Aurora, see
* <a href="https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/CHAP_AuroraOverview.html">
* What is Amazon Aurora?</a> in the <i>Amazon Aurora User Guide</i>.</p>
* <note>
* <p>This action only applies to Aurora DB clusters. The source DB engine must be MySQL.</p>
* </note>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { RDSClient, RestoreDBClusterFromS3Command } from "@aws-sdk/client-rds"; // ES Modules import
* // const { RDSClient, RestoreDBClusterFromS3Command } = require("@aws-sdk/client-rds"); // CommonJS import
* const client = new RDSClient(config);
* const input = { // RestoreDBClusterFromS3Message
* AvailabilityZones: [ // AvailabilityZones
* "STRING_VALUE",
* ],
* BackupRetentionPeriod: Number("int"),
* CharacterSetName: "STRING_VALUE",
* DatabaseName: "STRING_VALUE",
* DBClusterIdentifier: "STRING_VALUE", // required
* DBClusterParameterGroupName: "STRING_VALUE",
* VpcSecurityGroupIds: [ // VpcSecurityGroupIdList
* "STRING_VALUE",
* ],
* DBSubnetGroupName: "STRING_VALUE",
* Engine: "STRING_VALUE", // required
* EngineVersion: "STRING_VALUE",
* Port: Number("int"),
* MasterUsername: "STRING_VALUE", // required
* MasterUserPassword: "STRING_VALUE",
* OptionGroupName: "STRING_VALUE",
* PreferredBackupWindow: "STRING_VALUE",
* PreferredMaintenanceWindow: "STRING_VALUE",
* Tags: [ // TagList
* { // Tag
* Key: "STRING_VALUE",
* Value: "STRING_VALUE",
* },
* ],
* StorageEncrypted: true || false,
* KmsKeyId: "STRING_VALUE",
* EnableIAMDatabaseAuthentication: true || false,
* SourceEngine: "STRING_VALUE", // required
* SourceEngineVersion: "STRING_VALUE", // required
* S3BucketName: "STRING_VALUE", // required
* S3Prefix: "STRING_VALUE",
* S3IngestionRoleArn: "STRING_VALUE", // required
* BacktrackWindow: Number("long"),
* EnableCloudwatchLogsExports: [ // LogTypeList
* "STRING_VALUE",
* ],
* DeletionProtection: true || false,
* CopyTagsToSnapshot: true || false,
* Domain: "STRING_VALUE",
* DomainIAMRoleName: "STRING_VALUE",
* ServerlessV2ScalingConfiguration: { // ServerlessV2ScalingConfiguration
* MinCapacity: Number("double"),
* MaxCapacity: Number("double"),
* },
* NetworkType: "STRING_VALUE",
* ManageMasterUserPassword: true || false,
* MasterUserSecretKmsKeyId: "STRING_VALUE",
* StorageType: "STRING_VALUE",
* };
* const command = new RestoreDBClusterFromS3Command(input);
* const response = await client.send(command);
* // { // RestoreDBClusterFromS3Result
* // DBCluster: { // DBCluster
* // AllocatedStorage: Number("int"),
* // AvailabilityZones: [ // AvailabilityZones
* // "STRING_VALUE",
* // ],
* // BackupRetentionPeriod: Number("int"),
* // CharacterSetName: "STRING_VALUE",
* // DatabaseName: "STRING_VALUE",
* // DBClusterIdentifier: "STRING_VALUE",
* // DBClusterParameterGroup: "STRING_VALUE",
* // DBSubnetGroup: "STRING_VALUE",
* // Status: "STRING_VALUE",
* // AutomaticRestartTime: new Date("TIMESTAMP"),
* // PercentProgress: "STRING_VALUE",
* // EarliestRestorableTime: new Date("TIMESTAMP"),
* // Endpoint: "STRING_VALUE",
* // ReaderEndpoint: "STRING_VALUE",
* // CustomEndpoints: [ // StringList
* // "STRING_VALUE",
* // ],
* // MultiAZ: true || false,
* // Engine: "STRING_VALUE",
* // EngineVersion: "STRING_VALUE",
* // LatestRestorableTime: new Date("TIMESTAMP"),
* // Port: Number("int"),
* // MasterUsername: "STRING_VALUE",
* // DBClusterOptionGroupMemberships: [ // DBClusterOptionGroupMemberships
* // { // DBClusterOptionGroupStatus
* // DBClusterOptionGroupName: "STRING_VALUE",
* // Status: "STRING_VALUE",
* // },
* // ],
* // PreferredBackupWindow: "STRING_VALUE",
* // PreferredMaintenanceWindow: "STRING_VALUE",
* // ReplicationSourceIdentifier: "STRING_VALUE",
* // ReadReplicaIdentifiers: [ // ReadReplicaIdentifierList
* // "STRING_VALUE",
* // ],
* // DBClusterMembers: [ // DBClusterMemberList
* // { // DBClusterMember
* // DBInstanceIdentifier: "STRING_VALUE",
* // IsClusterWriter: true || false,
* // DBClusterParameterGroupStatus: "STRING_VALUE",
* // PromotionTier: Number("int"),
* // },
* // ],
* // VpcSecurityGroups: [ // VpcSecurityGroupMembershipList
* // { // VpcSecurityGroupMembership
* // VpcSecurityGroupId: "STRING_VALUE",
* // Status: "STRING_VALUE",
* // },
* // ],
* // HostedZoneId: "STRING_VALUE",
* // StorageEncrypted: true || false,
* // KmsKeyId: "STRING_VALUE",
* // DbClusterResourceId: "STRING_VALUE",
* // DBClusterArn: "STRING_VALUE",
* // AssociatedRoles: [ // DBClusterRoles
* // { // DBClusterRole
* // RoleArn: "STRING_VALUE",
* // Status: "STRING_VALUE",
* // FeatureName: "STRING_VALUE",
* // },
* // ],
* // IAMDatabaseAuthenticationEnabled: true || false,
* // CloneGroupId: "STRING_VALUE",
* // ClusterCreateTime: new Date("TIMESTAMP"),
* // EarliestBacktrackTime: new Date("TIMESTAMP"),
* // BacktrackWindow: Number("long"),
* // BacktrackConsumedChangeRecords: Number("long"),
* // EnabledCloudwatchLogsExports: [ // LogTypeList
* // "STRING_VALUE",
* // ],
* // Capacity: Number("int"),
* // EngineMode: "STRING_VALUE",
* // ScalingConfigurationInfo: { // ScalingConfigurationInfo
* // MinCapacity: Number("int"),
* // MaxCapacity: Number("int"),
* // AutoPause: true || false,
* // SecondsUntilAutoPause: Number("int"),
* // TimeoutAction: "STRING_VALUE",
* // SecondsBeforeTimeout: Number("int"),
* // },
* // DeletionProtection: true || false,
* // HttpEndpointEnabled: true || false,
* // ActivityStreamMode: "sync" || "async",
* // ActivityStreamStatus: "stopped" || "starting" || "started" || "stopping",
* // ActivityStreamKmsKeyId: "STRING_VALUE",
* // ActivityStreamKinesisStreamName: "STRING_VALUE",
* // CopyTagsToSnapshot: true || false,
* // CrossAccountClone: true || false,
* // DomainMemberships: [ // DomainMembershipList
* // { // DomainMembership
* // Domain: "STRING_VALUE",
* // Status: "STRING_VALUE",
* // FQDN: "STRING_VALUE",
* // IAMRoleName: "STRING_VALUE",
* // },
* // ],
* // TagList: [ // TagList
* // { // Tag
* // Key: "STRING_VALUE",
* // Value: "STRING_VALUE",
* // },
* // ],
* // GlobalWriteForwardingStatus: "enabled" || "disabled" || "enabling" || "disabling" || "unknown",
* // GlobalWriteForwardingRequested: true || false,
* // PendingModifiedValues: { // ClusterPendingModifiedValues
* // PendingCloudwatchLogsExports: { // PendingCloudwatchLogsExports
* // LogTypesToEnable: [
* // "STRING_VALUE",
* // ],
* // LogTypesToDisable: [
* // "STRING_VALUE",
* // ],
* // },
* // DBClusterIdentifier: "STRING_VALUE",
* // MasterUserPassword: "STRING_VALUE",
* // IAMDatabaseAuthenticationEnabled: true || false,
* // EngineVersion: "STRING_VALUE",
* // BackupRetentionPeriod: Number("int"),
* // AllocatedStorage: Number("int"),
* // Iops: Number("int"),
* // StorageType: "STRING_VALUE",
* // },
* // DBClusterInstanceClass: "STRING_VALUE",
* // StorageType: "STRING_VALUE",
* // Iops: Number("int"),
* // PubliclyAccessible: true || false,
* // AutoMinorVersionUpgrade: true || false,
* // MonitoringInterval: Number("int"),
* // MonitoringRoleArn: "STRING_VALUE",
* // PerformanceInsightsEnabled: true || false,
* // PerformanceInsightsKMSKeyId: "STRING_VALUE",
* // PerformanceInsightsRetentionPeriod: Number("int"),
* // ServerlessV2ScalingConfiguration: { // ServerlessV2ScalingConfigurationInfo
* // MinCapacity: Number("double"),
* // MaxCapacity: Number("double"),
* // },
* // NetworkType: "STRING_VALUE",
* // DBSystemId: "STRING_VALUE",
* // MasterUserSecret: { // MasterUserSecret
* // SecretArn: "STRING_VALUE",
* // SecretStatus: "STRING_VALUE",
* // KmsKeyId: "STRING_VALUE",
* // },
* // IOOptimizedNextAllowedModificationTime: new Date("TIMESTAMP"),
* // },
* // };
*
* ```
*
* @param RestoreDBClusterFromS3CommandInput - {@link RestoreDBClusterFromS3CommandInput}
* @returns {@link RestoreDBClusterFromS3CommandOutput}
* @see {@link RestoreDBClusterFromS3CommandInput} for command's `input` shape.
* @see {@link RestoreDBClusterFromS3CommandOutput} for command's `response` shape.
* @see {@link RDSClientResolvedConfig | config} for RDSClient's `config` shape.
*
* @throws {@link DBClusterAlreadyExistsFault} (client fault)
* <p>The user already has a DB cluster with the given identifier.</p>
*
* @throws {@link DBClusterNotFoundFault} (client fault)
* <p>
* <code>DBClusterIdentifier</code> doesn't refer to an existing DB cluster.</p>
*
* @throws {@link DBClusterParameterGroupNotFoundFault} (client fault)
* <p>
* <code>DBClusterParameterGroupName</code> doesn't refer to an existing DB
* cluster parameter group.</p>
*
* @throws {@link DBClusterQuotaExceededFault} (client fault)
* <p>The user attempted to create a new DB cluster and the user has already reached the
* maximum allowed DB cluster quota.</p>
*
* @throws {@link DBSubnetGroupNotFoundFault} (client fault)
* <p>
* <code>DBSubnetGroupName</code> doesn't refer to an existing DB subnet group.</p>
*
* @throws {@link DomainNotFoundFault} (client fault)
* <p>
* <code>Domain</code> doesn't refer to an existing Active Directory domain.</p>
*
* @throws {@link InsufficientStorageClusterCapacityFault} (client fault)
* <p>There is insufficient storage available for the current action. You might be able to
* resolve this error by updating your subnet group to use different Availability Zones
* that have more storage available.</p>
*
* @throws {@link InvalidDBClusterStateFault} (client fault)
* <p>The requested operation can't be performed while the cluster is in this state.</p>
*
* @throws {@link InvalidDBSubnetGroupStateFault} (client fault)
* <p>The DB subnet group cannot be deleted because it's in use.</p>
*
* @throws {@link InvalidS3BucketFault} (client fault)
* <p>The specified Amazon S3 bucket name can't be found or Amazon RDS isn't
* authorized to access the specified Amazon S3 bucket. Verify the <b>SourceS3BucketName</b> and <b>S3IngestionRoleArn</b> values and try again.</p>
*
* @throws {@link InvalidSubnet} (client fault)
* <p>The requested subnet is invalid, or multiple subnets were requested that are not all in a common VPC.</p>
*
* @throws {@link InvalidVPCNetworkStateFault} (client fault)
* <p>The DB subnet group doesn't cover all Availability Zones after it's
* created because of users' change.</p>
*
* @throws {@link KMSKeyNotAccessibleFault} (client fault)
* <p>An error occurred accessing an Amazon Web Services KMS key.</p>
*
* @throws {@link StorageQuotaExceededFault} (client fault)
* <p>The request would result in the user exceeding the allowed amount of storage
* available across all DB instances.</p>
*
* @throws {@link StorageTypeNotSupportedFault} (client fault)
* <p>The specified <code>StorageType</code> can't be associated with the DB instance.</p>
*
* @throws {@link RDSServiceException}
* <p>Base exception class for all service exceptions from RDS service.</p>
*
* @example To restore an Amazon Aurora DB cluster from Amazon S3
* ```javascript
* // The following example restores an Amazon Aurora MySQL version 5.7-compatible DB cluster from a MySQL 5.7 DB backup file in Amazon S3.
* const input = {
* "DBClusterIdentifier": "cluster-s3-restore",
* "Engine": "aurora-mysql",
* "MasterUserPassword": "mypassword",
* "MasterUsername": "admin",
* "S3BucketName": "mybucket",
* "S3IngestionRoleArn": "arn:aws:iam::123456789012:role/service-role/TestBackup",
* "S3Prefix": "test-backup",
* "SourceEngine": "mysql",
* "SourceEngineVersion": "5.7.28"
* };
* const command = new RestoreDBClusterFromS3Command(input);
* const response = await client.send(command);
* /* response ==
* {
* "DBCluster": {
* "AllocatedStorage": 1,
* "AssociatedRoles": [],
* "AvailabilityZones": [
* "us-west-2c",
* "us-west-2a",
* "us-west-2b"
* ],
* "BackupRetentionPeriod": 1,
* "ClusterCreateTime": "2020-07-27T14:22:08.095Z",
* "CopyTagsToSnapshot": false,
* "CrossAccountClone": false,
* "DBClusterArn": "arn:aws:rds:us-west-2:123456789012:cluster:cluster-s3-restore",
* "DBClusterIdentifier": "cluster-s3-restore",
* "DBClusterMembers": [],
* "DBClusterParameterGroup": "default.aurora-mysql5.7",
* "DBSubnetGroup": "default",
* "DbClusterResourceId": "cluster-SU5THYQQHOWCXZZDGXREXAMPLE",
* "DeletionProtection": false,
* "DomainMemberships": [],
* "Endpoint": "cluster-s3-restore.cluster-co3xyzabc123.us-west-2.rds.amazonaws.com",
* "Engine": "aurora-mysql",
* "EngineMode": "provisioned",
* "EngineVersion": "5.7.12",
* "HostedZoneId": "Z1PVIF0EXAMPLE",
* "HttpEndpointEnabled": false,
* "IAMDatabaseAuthenticationEnabled": false,
* "MasterUsername": "admin",
* "MultiAZ": false,
* "Port": 3306,
* "PreferredBackupWindow": "11:15-11:45",
* "PreferredMaintenanceWindow": "thu:12:19-thu:12:49",
* "ReadReplicaIdentifiers": [],
* "ReaderEndpoint": "cluster-s3-restore.cluster-ro-co3xyzabc123.us-west-2.rds.amazonaws.com",
* "Status": "creating",
* "StorageEncrypted": false,
* "VpcSecurityGroups": [
* {
* "Status": "active",
* "VpcSecurityGroupId": "sg-########"
* }
* ]
* }
* }
* *\/
* // example id: to-restore-an-amazon-aurora-db-cluster-from-amazon-s3-1680069516445
* ```
*
*/
export class RestoreDBClusterFromS3Command extends $Command<
RestoreDBClusterFromS3CommandInput,
RestoreDBClusterFromS3CommandOutput,
RDSClientResolvedConfig
> {
// Start section: command_properties
// End section: command_properties
public static getEndpointParameterInstructions(): EndpointParameterInstructions {
return {
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
Endpoint: { type: "builtInParams", name: "endpoint" },
Region: { type: "builtInParams", name: "region" },
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
};
}
/**
* @public
*/
constructor(readonly input: RestoreDBClusterFromS3CommandInput) {
// Start section: command_constructor
super();
// End section: command_constructor
}
/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: RDSClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<RestoreDBClusterFromS3CommandInput, RestoreDBClusterFromS3CommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
this.middlewareStack.use(
getEndpointPlugin(configuration, RestoreDBClusterFromS3Command.getEndpointParameterInstructions())
);
const stack = clientStack.concat(this.middlewareStack);
const { logger } = configuration;
const clientName = "RDSClient";
const commandName = "RestoreDBClusterFromS3Command";
const handlerExecutionContext: HandlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog: (_: any) => _,
outputFilterSensitiveLog: (_: any) => _,
};
const { requestHandler } = configuration;
return stack.resolve(
(request: FinalizeHandlerArguments<any>) =>
requestHandler.handle(request.request as __HttpRequest, options || {}),
handlerExecutionContext
);
}
/**
* @internal
*/
private serialize(input: RestoreDBClusterFromS3CommandInput, context: __SerdeContext): Promise<__HttpRequest> {
return se_RestoreDBClusterFromS3Command(input, context);
}
/**
* @internal
*/
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<RestoreDBClusterFromS3CommandOutput> {
return de_RestoreDBClusterFromS3Command(output, context);
}
// Start section: command_body_extra
// End section: command_body_extra
}