Amazon.RDS.AmazonRDSClient.RestoreDBInstanceFromDBSnapshot C# (CSharp) Method

RestoreDBInstanceFromDBSnapshot() public method

Creates a new DB instance from a DB snapshot. The target database is created from the source database restore point with the most of original configuration with the default security group and the default DB parameter group. By default, the new DB instance is created as a single-AZ deployment except when the instance is a SQL Server instance that has an option group that is associated with mirroring; in this case, the instance becomes a mirrored AZ deployment and not a single-AZ deployment.

If your intent is to replace your original DB instance with the new, restored DB instance, then rename your original DB instance before you call the RestoreDBInstanceFromDBSnapshot action. RDS does not allow two DB instances with the same name. Once you have renamed your original DB instance with a different identifier, then you can pass the original name of the DB instance as the DBInstanceIdentifier in the call to the RestoreDBInstanceFromDBSnapshot action. The result is that you will replace the original DB instance with the DB instance created from the snapshot.

If you are restoring from a shared manual DB snapshot, the DBSnapshotIdentifier must be the ARN of the shared DB snapshot.

/// Specified CIDRIP or EC2 security group is not authorized for the specified DB security /// group. /// /// /// /// RDS may not also be authorized via IAM to perform necessary actions on your behalf. /// /// /// User already has a DB instance with the given identifier. /// /// DBSecurityGroupName does not refer to an existing DB security group. /// /// DBSnapshotIdentifier does not refer to an existing DB snapshot. /// /// Subnets in the DB subnet group should cover at least two Availability Zones unless /// there is only one Availability Zone. /// /// DBSubnetGroupName does not refer to an existing DB subnet group. /// /// Domain does not refer to an existing Active Directory Domain. /// /// Request would result in user exceeding the allowed number of DB instances. /// /// Specified DB instance class is not available in the specified Availability Zone. /// /// The state of the DB snapshot does not allow deletion. /// /// Cannot restore from vpc backup to non-vpc DB instance. /// /// The requested subnet is invalid, or multiple subnets were requested that are not all /// in a common VPC. /// /// DB subnet group does not cover all Availability Zones after it is created because /// users' change. /// /// Error accessing KMS key. /// /// The specified option group could not be found. /// /// Provisioned IOPS not available in the specified Availability Zone. /// /// Request would result in user exceeding the allowed amount of storage available across /// all DB instances. /// /// StorageType specified cannot be associated with the DB Instance. ///
public RestoreDBInstanceFromDBSnapshot ( RestoreDBInstanceFromDBSnapshotRequest request ) : RestoreDBInstanceFromDBSnapshotResponse
request RestoreDBInstanceFromDBSnapshotRequest Container for the necessary parameters to execute the RestoreDBInstanceFromDBSnapshot service method.
return RestoreDBInstanceFromDBSnapshotResponse
        public RestoreDBInstanceFromDBSnapshotResponse RestoreDBInstanceFromDBSnapshot(RestoreDBInstanceFromDBSnapshotRequest request)
        {
            var marshaller = new RestoreDBInstanceFromDBSnapshotRequestMarshaller();
            var unmarshaller = RestoreDBInstanceFromDBSnapshotResponseUnmarshaller.Instance;

            return Invoke<RestoreDBInstanceFromDBSnapshotRequest,RestoreDBInstanceFromDBSnapshotResponse>(request, marshaller, unmarshaller);
        }

Usage Example

示例#1
0
        private static void restoreSnapshotIntoDBTarget(string databaseNameTarget, AmazonRDSClient rdsClient, DBSnapshot newerSnapshot)
        {
            RestoreDBInstanceFromDBSnapshotRequest restoreRequest = new RestoreDBInstanceFromDBSnapshotRequest()
            {
                DBSnapshotIdentifier = newerSnapshot.DBSnapshotIdentifier,
                DBInstanceIdentifier = databaseNameTarget

            };

            rdsClient.RestoreDBInstanceFromDBSnapshot(restoreRequest);
        }
AmazonRDSClient