vpcs
Creates, updates, deletes or gets a vpc resource or lists vpcs in a region
Overview
| Name | vpcs |
| Type | Resource |
| Description | Specifies a virtual private cloud (VPC).To add an IPv6 CIDR block to the VPC, see AWS::EC2::VPCCidrBlock.For more information, see Virtual private clouds (VPC) in the Amazon VPC User Guide. |
| Id | awscc.ec2.vpcs |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
vpc_id | string | |
instance_tenancy | string | The allowed tenancy of instances launched into the VPC.+default: An instance launched into the VPC runs on shared hardware by default, unless you explicitly specify a different tenancy during instance launch.+ dedicated: An instance launched into the VPC runs on dedicated hardware by default, unless you explicitly specify a tenancy of host during instance launch. You cannot specify a tenancy of default during instance launch.Updating InstanceTenancy requires no replacement only if you are updating its value from dedicated to default. Updating InstanceTenancy from default to dedicated requires replacement. |
ipv4_netmask_length | integer | The 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 What is IPAM? in the Amazon VPC IPAM User Guide. |
cidr_block_associations | array | |
cidr_block | string | The IPv4 network range for the VPC, in CIDR notation. For example, You must specify either |
ipv4_ipam_pool_id | string | The ID of an IPv4 IPAM pool you want to use for allocating this VPC's CIDR. For more information, see What is IPAM? in the Amazon VPC IPAM User Guide.You must specify eitherCidrBlock or Ipv4IpamPoolId. |
default_network_acl | string | |
enable_dns_support | boolean | Indicates 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 DNS attributes in your VPC. |
ipv6_cidr_blocks | array | |
default_security_group | string | |
enable_dns_hostnames | boolean | Indicates 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 DNS attributes in your VPC.You can only enable DNS hostnames if you've enabled DNS support. |
tags | array | The tags for the VPC. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
vpc_id | string | |
region | string | AWS region. |
For more information, see AWS::EC2::VPC.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | vpcs | INSERT | region |
delete_resource | vpcs | DELETE | Identifier, region |
update_resource | vpcs | UPDATE | Identifier, PatchDocument, region |
list_resources | vpcs_list_only | SELECT | region |
get_resource | vpcs | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
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 = '{{ region }}' AND
Identifier = '{{ vpc_id }}';
Lists all vpcs in a region.
SELECT
region,
vpc_id
FROM awscc.ec2.vpcs_list_only
WHERE
region = '{{ region }}';
INSERT example
Use the following StackQL query and manifest file to create a new vpc resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ 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 }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
/*+ 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 }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: vpc
props:
- name: instance_tenancy
value: '{{ instance_tenancy }}'
- name: ipv4_netmask_length
value: '{{ ipv4_netmask_length }}'
- name: cidr_block
value: '{{ cidr_block }}'
- name: ipv4_ipam_pool_id
value: '{{ ipv4_ipam_pool_id }}'
- name: enable_dns_support
value: '{{ enable_dns_support }}'
- name: enable_dns_hostnames
value: '{{ enable_dns_hostnames }}'
- name: tags
value:
- key: '{{ key }}'
value: '{{ value }}'
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 }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
DELETE example
/*+ delete */
DELETE FROM awscc.ec2.vpcs
WHERE
Identifier = '{{ vpc_id }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
Additional Parameters
Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:
| Parameter | Description |
|---|---|
ClientToken | A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.A client token is valid for 36 hours once used. After that, a resource request with the same client token is treated as a new request. If you do not specify a client token, one is generated for inclusion in the request. |
RoleArn | The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.If you do not specify a role, a temporary session is created using your AWS user credentials. |
TypeVersionId | For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used. |
Permissions
To operate on the vpcs resource, the following permissions are required:
- Read
- Create
- Update
- List
- Delete
ec2:DescribeVpcs,
ec2:DescribeSecurityGroups,
ec2:DescribeNetworkAcls,
ec2:DescribeVpcAttribute
ec2:CreateVpc,
ec2:DescribeVpcs,
ec2:DescribeVpcAttribute,
ec2:ModifyVpcAttribute,
ec2:CreateTags
ec2:CreateTags,
ec2:ModifyVpcAttribute,
ec2:DescribeVpcAttribute,
ec2:DeleteTags,
ec2:ModifyVpcTenancy
ec2:DescribeVpcs
ec2:DeleteVpc,
ec2:DescribeVpcs