CopySnapshot
Copies a manual snapshot of an instance or disk as another manual snapshot, or copies an automatic snapshot of an instance or disk as a manual snapshot. This operation can also be used to copy a manual or automatic snapshot of an instance or a disk from one AWS Region to another in Amazon Lightsail.
When copying a manual snapshot, be sure to define the source
region
, source snapshot name
, and target snapshot name
parameters.
When copying an automatic snapshot, be sure to define the
source region
, source resource name
, target snapshot
name
, and either the restore date
or the use latest restorable
auto snapshot
parameters.
Request Syntax
{
"restoreDate": "string
",
"sourceRegion": "string
",
"sourceResourceName": "string
",
"sourceSnapshotName": "string
",
"targetSnapshotName": "string
",
"useLatestRestorableAutoSnapshot": boolean
}
Request Parameters
For information about the parameters that are common to all actions, see Common Parameters.
The request accepts the following data in JSON format.
- restoreDate
-
The date of the source automatic snapshot to copy. Use the
get auto snapshots
operation to identify the dates of the available automatic snapshots.Constraints:
-
Must be specified in
YYYY-MM-DD
format. -
This parameter cannot be defined together with the
use latest restorable auto snapshot
parameter. Therestore date
anduse latest restorable auto snapshot
parameters are mutually exclusive. -
Define this parameter only when copying an automatic snapshot as a manual snapshot. For more information, see the Amazon Lightsail Developer Guide
.
Type: String
Required: No
-
- sourceRegion
-
The AWS Region where the source manual or automatic snapshot is located.
Type: String
Valid Values:
us-east-1 | us-east-2 | us-west-1 | us-west-2 | eu-west-1 | eu-west-2 | eu-west-3 | eu-central-1 | ca-central-1 | ap-south-1 | ap-southeast-1 | ap-southeast-2 | ap-northeast-1 | ap-northeast-2 | eu-north-1
Required: Yes
- sourceResourceName
-
The name of the source instance or disk from which the source automatic snapshot was created.
Constraint:
-
Define this parameter only when copying an automatic snapshot as a manual snapshot. For more information, see the Amazon Lightsail Developer Guide
.
Type: String
Required: No
-
- sourceSnapshotName
-
The name of the source manual snapshot to copy.
Constraint:
-
Define this parameter only when copying a manual snapshot as another manual snapshot.
Type: String
Pattern:
\w[\w\-]*\w
Required: No
-
- targetSnapshotName
-
The name of the new manual snapshot to be created as a copy.
Type: String
Pattern:
\w[\w\-]*\w
Required: Yes
- useLatestRestorableAutoSnapshot
-
A Boolean value to indicate whether to use the latest available automatic snapshot of the specified source instance or disk.
Constraints:
-
This parameter cannot be defined together with the
restore date
parameter. Theuse latest restorable auto snapshot
andrestore date
parameters are mutually exclusive. -
Define this parameter only when copying an automatic snapshot as a manual snapshot. For more information, see the Amazon Lightsail Developer Guide
.
Type: Boolean
Required: No
-
Response Syntax
{
"operations": [
{
"createdAt": number,
"errorCode": "string",
"errorDetails": "string",
"id": "string",
"isTerminal": boolean,
"location": {
"availabilityZone": "string",
"regionName": "string"
},
"operationDetails": "string",
"operationType": "string",
"resourceName": "string",
"resourceType": "string",
"status": "string",
"statusChangedAt": number
}
]
}
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
- operations
-
An array of objects that describe the result of the action, such as the status of the request, the timestamp of the request, and the resources affected by the request.
Type: Array of Operation objects
Errors
For information about the errors that are common to all actions, see Common Errors.
- AccessDeniedException
-
Lightsail throws this exception when the user cannot be authenticated or uses invalid credentials to access a resource.
HTTP Status Code: 400
- AccountSetupInProgressException
-
Lightsail throws this exception when an account is still in the setup in progress state.
HTTP Status Code: 400
- InvalidInputException
-
Lightsail throws this exception when user input does not conform to the validation rules of an input field.
Note
Domain and distribution APIs are only available in the N. Virginia (
us-east-1
) AWS Region. Please set your AWS Region configuration tous-east-1
to create, view, or edit these resources.HTTP Status Code: 400
- NotFoundException
-
Lightsail throws this exception when it cannot find a resource.
HTTP Status Code: 400
- OperationFailureException
-
Lightsail throws this exception when an operation fails to execute.
HTTP Status Code: 400
- ServiceException
-
A general service exception.
HTTP Status Code: 500
- UnauthenticatedException
-
Lightsail throws this exception when the user has not been authenticated.
HTTP Status Code: 400
Examples
In the following example or examples, the Authorization header contents
(AUTHPARAMS
) must be replaced with an AWS Signature Version 4 signature. For
more information about creating these signatures, see Signature Version 4 Signing Process
in the
AWS General Reference.
You need to learn how to sign HTTP requests only if you intend to manually create them.
When you use the AWS Command Line Interface (AWS CLI)
Copy an automatic snapshot
The following example creates a new manual snapshot named
CopiedAutoSnapshot-2019-09-25
as a copy of the existing automatic snapshot
named 2019-09-25
from the WordPress-1
instance in the
us-west-2
AWS Region.
Sample Request
POST / HTTP/1.1
Host: lightsail.us-west-2.amazonaws.com
Accept-Encoding: identity
X-Amz-Target: Lightsail_20161128.CopySnapshot
Content-Type: application/x-amz-json-1.1
User-Agent: AGENT
X-Amz-Date: 20190927T194244Z
Authorization: AUTHPARAMS
Content-Length: 150
{
"sourceResourceName": "WordPress-1",
"restoreDate": "2019-09-25",
"targetSnapshotName": "CopiedAutoSnapshot-2019-09-25",
"sourceRegion": "us-west-2"
}
Sample Response
HTTP/1.1 200 OK
Server: Server
Date: Fri, 27 Sep 2019 19:42:46 GMT
Content-Type: application/x-amz-json-1.1
Content-Length: 380
x-amzn-RequestId: 69449102-9023-431e-8a00-7EXAMPLE6970
Connection: keep-alive
{
"operations": [{
"createdAt": 1.56961336589E9,
"id": "0710de23-b848-4146-887d-ec12093c049d",
"isTerminal": false,
"location": {
"availabilityZone": "all",
"regionName": "us-west-2"
},
"operationDetails": "us-west-2:WordPress-1",
"operationType": "CopySnapshot",
"resourceName": "CopiedAutoSnapshot-2019-09-25",
"resourceType": "InstanceSnapshot",
"status": "Started",
"statusChangedAt": 1.56961336589E9
}]
}
Copy a manual snapshot
The following example creates a new manual snapshot named
CopiedManualSnapshot-2019-09-25
as a copy of the existing manual snapshot
named WordPress-1-1569608575
in the us-west-2
AWS Region.
Sample Request
POST / HTTP/1.1
Host: lightsail.us-west-2.amazonaws.com
Accept-Encoding: identity
X-Amz-Target: Lightsail_20161128.CopySnapshot
Content-Type: application/x-amz-json-1.1
User-Agent: AGENT
X-Amz-Date: 20190927T195200Z
Authorization: AUTHPARAMS
Content-Length: 134
{
"sourceSnapshotName": "WordPress-1-1569608575",
"targetSnapshotName": "CopiedManualSnapshot-2019-09-25",
"sourceRegion": "us-west-2"
}
Sample Response
HTTP/1.1 200 OK
Server: Server
Date: Fri, 27 Sep 2019 19:52:01 GMT
Content-Type: application/x-amz-json-1.1
Content-Length: 395
x-amzn-RequestId: 5e3e211b-0afe-439e-bead-8EXAMPLEb3c8
Connection: keep-alive
{
"operations": [{
"createdAt": 1.569613921044E9,
"id": "0d4f2d2a-78ce-44d1-82fe-33588af9afa0",
"isTerminal": false,
"location": {
"availabilityZone": "all",
"regionName": "us-west-2"
},
"operationDetails": "us-west-2:WordPress-1-1569608575",
"operationType": "CopySnapshot",
"resourceName": "CopiedManualSnapshot-2019-09-25",
"resourceType": "InstanceSnapshot",
"status": "Started",
"statusChangedAt": 1.569613921044E9
}]
}
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: