Skip to main content

service_network_vpc_associations

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

Overview

Nameservice_network_vpc_associations
TypeResource
Idaws.vpc_lattice.service_network_vpc_associations

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringThe ID of the association. (pattern: <code>snva-[0-9a-z]{17}</code>)
arnstringThe Amazon Resource Name (ARN) of the association. (pattern: <code>arn:[a-z0-9-]+:vpc-lattice:[a-zA-Z0-9-]+:\d{12}:servicenetworkvpcassociation/snva-[0-9a-z]{17}</code>)
created_atstring (date-time)The date and time that the association was created, in ISO-8601 format.
created_bystringThe account that created the association. (pattern: <code>[0-9]{12}</code>)
dns_optionsobjectThe DNS configuration options.
failure_codestringThe failure code.
failure_messagestringThe failure message.
last_updated_atstring (date-time)The date and time that the association was last updated, in ISO-8601 format.
private_dns_enabledbooleanIndicates if private DNS is enabled in the VPC association.
security_group_idsarrayThe IDs of the security groups.
service_network_arnstringThe Amazon Resource Name (ARN) of the service network. (pattern: <code>arn:[a-z0-9-]+:vpc-lattice:[a-zA-Z0-9-]+:\d{12}:servicenetwork/sn-[0-9a-z]{17}</code>)
service_network_idstringThe ID of the service network. (pattern: <code>sn-[0-9a-z]{17}</code>)
service_network_namestringThe name of the service network. (pattern: <code>(?![-])(?!.[-]$)(?!.[-]{2})[a-z0-9-]+</code>)
statusstringThe status of the association. (CREATE_IN_PROGRESS, ACTIVE, UPDATE_IN_PROGRESS, DELETE_IN_PROGRESS, CREATE_FAILED, DELETE_FAILED, UPDATE_FAILED)
vpc_idstringThe ID of the VPC. (pattern: <code>vpc-(([0-9a-z]{8})|([0-9a-z]{17}))</code>)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_service_network_vpc_associationselectservice_network_vpc_association_identifier, regionRetrieves information about the specified association between a service network and a VPC.
list_service_network_vpc_associationsselectregionserviceNetworkIdentifier, vpcIdentifier, maxResults, nextTokenLists the associations between a service network and a VPC. You can filter the list either by VPC or service network. You must provide either the ID of the service network identifier or the ID of the VPC.
create_service_network_vpc_associationinsertregion, serviceNetworkIdentifier, vpcIdentifierAssociates a VPC with a service network. When you associate a VPC with the service network, it enables all the resources within that VPC to be clients and communicate with other services in the service network. For more information, see Manage VPC associations in the Amazon VPC Lattice User Guide. You can't use this operation if there is a disassociation in progress. If the association fails, retry by deleting the association and recreating it. As a result of this operation, the association gets created in the service network account and the VPC owner account. If you add a security group to the service network and VPC association, the association must continue to always have at least one security group. You can add or edit security groups at any time. However, to remove all security groups, you must first delete the association and recreate it without security groups.
update_service_network_vpc_associationupdateservice_network_vpc_association_identifier, regionUpdates the service network and VPC association. If you add a security group to the service network and VPC association, the association must continue to have at least one security group. You can add or edit security groups at any time. However, to remove all security groups, you must first delete the association and then recreate it without security groups.
delete_service_network_vpc_associationdeleteservice_network_vpc_association_identifier, regionDisassociates the VPC from the service network. You can't disassociate the VPC if there is a create or update association in progress.

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)
service_network_vpc_association_identifierstringThe ID or ARN of the association.
maxResultsintegerThe maximum number of results to return.
nextTokenstringA pagination token for the next page of results.
serviceNetworkIdentifierstringThe ID or ARN of the service network.
vpcIdentifierstringThe ID or ARN of the VPC.

SELECT examples

Retrieves information about the specified association between a service network and a VPC.

SELECT
id,
arn,
created_at,
created_by,
dns_options,
failure_code,
failure_message,
last_updated_at,
private_dns_enabled,
security_group_ids,
service_network_arn,
service_network_id,
service_network_name,
status,
vpc_id
FROM aws.vpc_lattice.service_network_vpc_associations
WHERE service_network_vpc_association_identifier = '{{ service_network_vpc_association_identifier }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples

Associates a VPC with a service network. When you associate a VPC with the service network, it enables all the resources within that VPC to be clients and communicate with other services in the service network. For more information, see Manage VPC associations in the Amazon VPC Lattice User Guide. You can't use this operation if there is a disassociation in progress. If the association fails, retry by deleting the association and recreating it. As a result of this operation, the association gets created in the service network account and the VPC owner account. If you add a security group to the service network and VPC association, the association must continue to always have at least one security group. You can add or edit security groups at any time. However, to remove all security groups, you must first delete the association and recreate it without security groups.

INSERT INTO aws.vpc_lattice.service_network_vpc_associations (
clientToken,
serviceNetworkIdentifier,
vpcIdentifier,
privateDnsEnabled,
securityGroupIds,
tags,
dnsOptions,
region
)
SELECT
'{{ clientToken }}',
'{{ serviceNetworkIdentifier }}' /* required */,
'{{ vpcIdentifier }}' /* required */,
{{ privateDnsEnabled }},
'{{ securityGroupIds }}',
'{{ tags }}',
'{{ dnsOptions }}',
'{{ region }}'
RETURNING
id,
arn,
created_by,
dns_options,
private_dns_enabled,
security_group_ids,
status
;

UPDATE examples

Updates the service network and VPC association. If you add a security group to the service network and VPC association, the association must continue to have at least one security group. You can add or edit security groups at any time. However, to remove all security groups, you must first delete the association and then recreate it without security groups.

UPDATE aws.vpc_lattice.service_network_vpc_associations
SET
securityGroupIds = '{{ securityGroupIds }}',
privateDnsEnabled = {{ privateDnsEnabled }},
dnsOptions = '{{ dnsOptions }}'
WHERE
service_network_vpc_association_identifier = '{{ service_network_vpc_association_identifier }}' --required
AND region = '{{ region }}' --required
RETURNING
id,
arn,
created_by,
dns_options,
private_dns_enabled,
security_group_ids,
status;

DELETE examples

Disassociates the VPC from the service network. You can't disassociate the VPC if there is a create or update association in progress.

DELETE FROM aws.vpc_lattice.service_network_vpc_associations
WHERE service_network_vpc_association_identifier = '{{ service_network_vpc_association_identifier }}' --required
AND region = '{{ region }}' --required
;