Skip to main content

source_networks

Creates, updates, deletes, gets or lists a source_networks resource.

Overview

Namesource_networks
TypeResource
Idaws.drs.source_networks

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
arnstringThe ARN of the Source Network. (pattern: <code>arn:.{16,2044}</code>)
cfn_stack_namestringCloudFormation stack name that was deployed for recovering the Source Network. (pattern: <code>[a-zA-Z][-a-zA-Z0-9]*</code>)
last_recoveryobjectAn object containing information regarding the last recovery of the Source Network.
launched_vpc_idstringID of the recovered VPC following Source Network recovery. (pattern: <code>vpc-[0-9a-fA-F]{8,}</code>)
replication_statusstringStatus of Source Network Replication. Possible values: (a) STOPPED - Source Network is not replicating. (b) IN_PROGRESS - Source Network is being replicated. (c) PROTECTED - Source Network was replicated successfully and is being synchronized for changes. (d) ERROR - Source Network replication has failed (STOPPED, IN_PROGRESS, PROTECTED, ERROR)
replication_status_detailsstringError details in case Source Network replication status is ERROR.
source_account_idstringAccount ID containing the VPC protected by the Source Network. (pattern: <code>.[0-9]{12,}.</code>)
source_network_idstringSource Network ID. (pattern: <code>sn-[0-9a-zA-Z]{17}</code>)
source_regionstringRegion containing the VPC protected by the Source Network. (pattern: <code>(us(-gov)?|ap|ca|cn|eu|eusc|sa|af|me|mx|il)-([a-z]{2}-)?(central|north|(north(?:east|west))|south|south(?:east|west)|east|west)-[0-9]</code>)
source_vpc_idstringVPC ID protected by the Source Network. (pattern: <code>vpc-[0-9a-fA-F]{8,}</code>)
tagsobjectA list of tags associated with the Source Network.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_source_networksselectregionLists all Source Networks or multiple Source Networks filtered by ID.
create_source_networkinsertregion, vpcID, originAccountID, originRegionCreate a new Source Network resource for a provided VPC ID.
associate_source_network_stackupdateregion, sourceNetworkID, cfnStackNameAssociate a Source Network to an existing CloudFormation Stack and modify launch templates to use this network. Can be used for reverting to previously deployed CloudFormation stacks.
delete_source_networkdeleteregionDelete Source Network resource.
export_source_network_cfn_templateexecregion, sourceNetworkIDExport the Source Network CloudFormation template to an S3 bucket.
start_source_network_recoveryexecregion, sourceNetworksDeploy VPC for the specified Source Network and modify launch templates to use this network. The VPC will be deployed using a dedicated CloudFormation stack.
start_source_network_replicationexecregion, sourceNetworkIDStarts replication for a Source Network. This action would make the Source Network protected.
stop_source_network_replicationexecregion, sourceNetworkIDStops replication for a Source Network. This action would make the Source Network unprotected.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Lists all Source Networks or multiple Source Networks filtered by ID.

SELECT
arn,
cfn_stack_name,
last_recovery,
launched_vpc_id,
replication_status,
replication_status_details,
source_account_id,
source_network_id,
source_region,
source_vpc_id,
tags
FROM aws.drs.source_networks
WHERE region = '{{ region }}' -- required
;

INSERT examples

Create a new Source Network resource for a provided VPC ID.

INSERT INTO aws.drs.source_networks (
vpcID,
originAccountID,
originRegion,
tags,
region
)
SELECT
'{{ vpcID }}' /* required */,
'{{ originAccountID }}' /* required */,
'{{ originRegion }}' /* required */,
'{{ tags }}',
'{{ region }}'
RETURNING
source_network_id
;

UPDATE examples

Associate a Source Network to an existing CloudFormation Stack and modify launch templates to use this network. Can be used for reverting to previously deployed CloudFormation stacks.

UPDATE aws.drs.source_networks
SET
sourceNetworkID = '{{ sourceNetworkID }}',
cfnStackName = '{{ cfnStackName }}'
WHERE
region = '{{ region }}' --required
AND sourceNetworkID = '{{ sourceNetworkID }}' --required
AND cfnStackName = '{{ cfnStackName }}' --required
RETURNING
job;

DELETE examples

Delete Source Network resource.

DELETE FROM aws.drs.source_networks
WHERE region = '{{ region }}' --required
;

Lifecycle Methods

Export the Source Network CloudFormation template to an S3 bucket.

EXEC aws.drs.source_networks.export_source_network_cfn_template
@region='{{ region }}' --required
@@json=
'{
"sourceNetworkID": "{{ sourceNetworkID }}"
}'
;