RestoreServer - OpsWorks

RestoreServer

Restores a backup to a server that is in a CONNECTION_LOST, HEALTHY, RUNNING, UNHEALTHY, or TERMINATED state. When you run RestoreServer, the server's EC2 instance is deleted, and a new EC2 instance is configured. RestoreServer maintains the existing server endpoint, so configuration management of the server's client devices (nodes) should continue to work.

Restoring from a backup is performed by creating a new EC2 instance. If restoration is successful, and the server is in a HEALTHY state, AWS OpsWorks CM switches traffic over to the new instance. After restoration is finished, the old EC2 instance is maintained in a Running or Stopped state, but is eventually terminated.

This operation is asynchronous.

An InvalidStateException is thrown when the server is not in a valid state. A ResourceNotFoundException is thrown when the server does not exist. A ValidationException is raised when parameters of the request are not valid.

Request Syntax

{ "BackupId": "string", "InstanceType": "string", "KeyPair": "string", "ServerName": "string" }

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.

BackupId

The ID of the backup that you want to use to restore a server.

Type: String

Length Constraints: Maximum length of 79.

Pattern: [a-zA-Z][a-zA-Z0-9\-\.\:]*

Required: Yes

InstanceType

The type of instance to restore. Valid values must be specified in the following format: ^([cm][34]|t2).* For example, m5.large. Valid values are m5.large, r5.xlarge, and r5.2xlarge. If you do not specify this parameter, RestoreServer uses the instance type from the specified backup.

Type: String

Length Constraints: Maximum length of 10000.

Pattern: (?s).*

Required: No

KeyPair

The name of the key pair to set on the new EC2 instance. This can be helpful if the administrator no longer has the SSH key.

Type: String

Length Constraints: Maximum length of 10000.

Pattern: .*

Required: No

ServerName

The name of the server that you want to restore.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 40.

Pattern: [a-zA-Z][a-zA-Z0-9\-]*

Required: Yes

Response Syntax

{ "Server": { "AssociatePublicIpAddress": boolean, "BackupRetentionCount": number, "CloudFormationStackArn": "string", "CreatedAt": number, "CustomDomain": "string", "DisableAutomatedBackup": boolean, "Endpoint": "string", "Engine": "string", "EngineAttributes": [ { "Name": "string", "Value": "string" } ], "EngineModel": "string", "EngineVersion": "string", "InstanceProfileArn": "string", "InstanceType": "string", "KeyPair": "string", "MaintenanceStatus": "string", "PreferredBackupWindow": "string", "PreferredMaintenanceWindow": "string", "SecurityGroupIds": [ "string" ], "ServerArn": "string", "ServerName": "string", "ServiceRoleArn": "string", "Status": "string", "StatusReason": "string", "SubnetIds": [ "string" ] } }

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.

Server

Describes a configuration management server.

Type: Server object

Errors

For information about the errors that are common to all actions, see Common Errors.

InvalidStateException

The resource is in a state that does not allow you to perform a specified action.

HTTP Status Code: 400

ResourceNotFoundException

The requested resource does not exist, or access was denied.

HTTP Status Code: 400

ValidationException

One or more of the provided request parameters are not valid.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: