Skip to main content

vpcs

Creates, updates, deletes or gets a vpc resource or lists vpcs in a region

Overview

Namevpcs
TypeResource
DescriptionSpecifies a virtual private cloud (VPC).
To add an IPv6 CIDR block to the VPC, see [AWS::EC2::VPCCidrBlock](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpccidrblock.html).
For more information, see [Virtual private clouds (VPC)](https://docs.aws.amazon.com/vpc/latest/userguide/configure-your-vpc.html) in the *Amazon VPC User Guide*.
Idawscc.ec2.vpcs

Fields

NameDatatypeDescription
vpc_idstring
instance_tenancystringThe allowed tenancy of instances launched into the VPC.<br />+ &#96;&#96;default&#96;&#96;: An instance launched into the VPC runs on shared hardware by default, unless you explicitly specify a different tenancy during instance launch.<br />+ &#96;&#96;dedicated&#96;&#96;: An instance launched into the VPC runs on dedicated hardware by default, unless you explicitly specify a tenancy of &#96;&#96;host&#96;&#96; during instance launch. You cannot specify a tenancy of &#96;&#96;default&#96;&#96; during instance launch.<br /><br />Updating &#96;&#96;InstanceTenancy&#96;&#96; requires no replacement only if you are updating its value from &#96;&#96;dedicated&#96;&#96; to &#96;&#96;default&#96;&#96;. Updating &#96;&#96;InstanceTenancy&#96;&#96; from &#96;&#96;default&#96;&#96; to &#96;&#96;dedicated&#96;&#96; requires replacement.
ipv4_netmask_lengthintegerThe netmask length of the IPv4 CIDR you want to allocate to this VPC from an Amazon VPC IP Address Manager (IPAM) pool. For more information about IPAM, see &#91;What is IPAM?&#93;(https://docs.aws.amazon.com//vpc/latest/ipam/what-is-it-ipam.html) in the &#42;Amazon VPC IPAM User Guide&#42;.
cidr_block_associationsarray
cidr_blockstringThe IPv4 network range for the VPC, in CIDR notation. For example, &#96;&#96;10.0.0.0/16&#96;&#96;. We modify the specified CIDR block to its canonical form; for example, if you specify &#96;&#96;100.68.0.18/18&#96;&#96;, we modify it to &#96;&#96;100.68.0.0/18&#96;&#96;.<br />You must specify either&#96;&#96;CidrBlock&#96;&#96; or &#96;&#96;Ipv4IpamPoolId&#96;&#96;.
ipv4_ipam_pool_idstringThe ID of an IPv4 IPAM pool you want to use for allocating this VPC's CIDR. For more information, see &#91;What is IPAM?&#93;(https://docs.aws.amazon.com//vpc/latest/ipam/what-is-it-ipam.html) in the &#42;Amazon VPC IPAM User Guide&#42;.<br />You must specify either&#96;&#96;CidrBlock&#96;&#96; or &#96;&#96;Ipv4IpamPoolId&#96;&#96;.
default_network_aclstring
enable_dns_supportbooleanIndicates whether the DNS resolution is supported for the VPC. If enabled, queries to the Amazon provided DNS server at the 169.254.169.253 IP address, or the reserved IP address at the base of the VPC network range "plus two" succeed. If disabled, the Amazon provided DNS service in the VPC that resolves public DNS hostnames to IP addresses is not enabled. Enabled by default. For more information, see &#91;DNS attributes in your VPC&#93;(https://docs.aws.amazon.com/vpc/latest/userguide/vpc-dns.html#vpc-dns-support).
ipv6_cidr_blocksarray
default_security_groupstring
enable_dns_hostnamesbooleanIndicates whether the instances launched in the VPC get DNS hostnames. If enabled, instances in the VPC get DNS hostnames; otherwise, they do not. Disabled by default for nondefault VPCs. For more information, see &#91;DNS attributes in your VPC&#93;(https://docs.aws.amazon.com/vpc/latest/userguide/vpc-dns.html#vpc-dns-support).<br />You can only enable DNS hostnames if you've enabled DNS support.
tagsarrayThe tags for the VPC.
regionstringAWS region.

For more information, see AWS::EC2::VPC.

Methods

NameResourceAccessible byRequired Params
create_resourcevpcsINSERTregion
delete_resourcevpcsDELETEIdentifier, region
update_resourcevpcsUPDATEIdentifier, PatchDocument, region
list_resourcesvpcs_list_onlySELECTregion
get_resourcevpcsSELECTIdentifier, region

SELECT examples

Gets all properties from an individual vpc.

SELECT
region,
vpc_id,
instance_tenancy,
ipv4_netmask_length,
cidr_block_associations,
cidr_block,
ipv4_ipam_pool_id,
default_network_acl,
enable_dns_support,
ipv6_cidr_blocks,
default_security_group,
enable_dns_hostnames,
tags
FROM awscc.ec2.vpcs
WHERE
region = 'us-east-1' AND
Identifier = '{{ vpc_id }}';

INSERT example

Use the following StackQL query and manifest file to create a new vpc resource, using stack-deploy.

/*+ create */
INSERT INTO awscc.ec2.vpcs (
InstanceTenancy,
Ipv4NetmaskLength,
CidrBlock,
Ipv4IpamPoolId,
EnableDnsSupport,
EnableDnsHostnames,
Tags,
region
)
SELECT
'{{ instance_tenancy }}',
'{{ ipv4_netmask_length }}',
'{{ cidr_block }}',
'{{ ipv4_ipam_pool_id }}',
'{{ enable_dns_support }}',
'{{ enable_dns_hostnames }}',
'{{ tags }}',
'{{ region }}';

UPDATE example

Use the following StackQL query and manifest file to update a vpc resource, using stack-deploy.

/*+ update */
UPDATE awscc.ec2.vpcs
SET PatchDocument = string('{{ {
"InstanceTenancy": instance_tenancy,
"EnableDnsSupport": enable_dns_support,
"EnableDnsHostnames": enable_dns_hostnames,
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ vpc_id }}';

DELETE example

/*+ delete */
DELETE FROM awscc.ec2.vpcs
WHERE
Identifier = '{{ vpc_id }}' AND
region = 'us-east-1';

Permissions

To operate on the vpcs resource, the following permissions are required:

ec2:DescribeVpcs,
ec2:DescribeSecurityGroups,
ec2:DescribeNetworkAcls,
ec2:DescribeVpcAttribute