vpc#

State module for managing EC2 Virtual Private Gateways.

async idem_aws.states.aws.ec2.vpc.present(hub, ctx, name: str, resource_id: str = None, cidr_block_association_set: List[CidrBlockAssociationSet] = None, ipv6_cidr_block_association_set: List[Ipv6CidrBlockAssociationSet] = None, instance_tenancy: str = None, tags: Dict[str, Any] = None, enable_dns_hostnames: bool = None, enable_dns_support: bool = None) Dict[str, Any][source]#

Creates a VPC with the specified IPv4 CIDR block. The smallest VPC you can create uses a /28 netmask (16 IPv4 addresses), and the largest uses a /16 netmask (65,536 IPv4 addresses). For more information about how large to make your VPC, see Your VPC and subnets in the Amazon Virtual Private Cloud User Guide. You can optionally request an IPv6 CIDR block for the VPC. You can request an Amazon-provided IPv6 CIDR block from Amazon’s pool of IPv6 addresses, or an IPv6 CIDR block from an IPv6 address pool that you provisioned through bring your own IP addresses (BYOIP). By default, each instance you launch in the VPC has the default DHCP options, which include only a default DNS server that we provide (AmazonProvidedDNS). For more information, see DHCP options sets in the Amazon Virtual Private Cloud User Guide. You can specify the instance tenancy value for the VPC when you create it. You can’t change this value for the VPC after you create it. For more information, see Dedicated Instances in the Amazon Elastic Compute Cloud User Guide.

Parameters:
  • name (str) – An Idem name of the resource.

  • resource_id (str, Optional) – AWS VPC ID

  • cidr_block_association_set (List, Optional) – Information about the IPv4 CIDR blocks associated with the VPC. Defaults to None. * CidrBlock (str) – An IPv4 CIDR block to associate with the VPC. * Ipv4IpamPoolId (str) – Associate a CIDR allocated from an IPv4 IPAM pool to a VPC. * Ipv4NetmaskLength (int) – The netmask length of the IPv4 CIDR you would like to associate from an Amazon VPC IP Address Manager (IPAM) pool.

  • ipv6_cidr_block_association_set (List, Optional) –

    Information about the IPv6 CIDR blocks associated with the VPC. Defaults to None. * Ipv6CidrBlock (str) – An IPv6 CIDR block from the IPv6 address pool. You must also specify Ipv6Pool in the request. * Ipv6IpamPoolId (str) – Associates a CIDR allocated from an IPv6 IPAM pool to a VPC. * Ipv6NetmaskLength (int) – The netmask length of the IPv6 CIDR you would like to associate from an

    Amazon VPC IP Address Manager (IPAM) pool.

    • Ipv6CidrBlockNetworkBorderGroup (str) – The name of the location from which we advertise the IPV6 CIDR

      block. Use this parameter to limit the CIDR block to this location. You must set AmazonProvidedIpv6CidrBlock to true to use this parameter. You can have one IPv6 CIDR block association per network border group.

    • AmazonProvidedIpv6CidrBlock (boolean) – Requests an Amazon-provided IPv6 CIDR block with a /56 prefix

      length for the VPC. You cannot specify the range of IPv6 addresses, or the size of the CIDR block.

  • instance_tenancy (str, Optional) – The tenancy options for instances launched into the VPC. For default, instances are launched with shared tenancy by default. You can launch instances with any tenancy into a shared tenancy VPC. For dedicated, instances are launched as dedicated tenancy instances by default. You can only launch instances with a tenancy of dedicated or host into a dedicated tenancy VPC. Important: The host value cannot be used with this parameter. Use the default or dedicated values only. Default: default. Defaults to None.

  • tags (Dict or List, Optional) –

    Dict in the format of {tag-key: tag-value} or List of tags in the format of [{“Key”: tag-key, “Value”: tag-value}] to associate with the VPC. Each tag consists of a key name and an associated value. Defaults to None. * Key (str, Optional): The key of the tag. Constraints: Tag keys are case-sensitive and accept a maximum of 127 Unicode

    characters. May not begin with aws:.

    • Value(str, Optional): The value of the tag. Constraints: Tag values are case-sensitive and accept a maximum of 256

      Unicode characters.

  • enable_dns_hostnames (bool, Optional) – Indicates whether the instances launched in the VPC get DNS hostnames. If enabled, instances in the VPC get DNS hostnames; otherwise, they do not. You cannot modify the DNS resolution and DNS hostnames attributes in the same request. Use separate requests for each attribute. You can only enable DNS hostnames if you’ve enabled DNS support.

  • enable_dns_support (bool, Optional) – 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. You cannot modify the DNS resolution and DNS hostnames attributes in the same request. Use separate requests for each attribute.

Request Syntax:
[vpc-resource-id]:

aws.ec2.vpc.present: - resource_id: ‘string’ - cidr_block_association_set:

  • CidrBlock: ‘string’ Ipv4IpamPoolId: ‘string’ Ipv4NetmaskLength: ‘integer’

  • ipv6_cidr_block_association_set: - Ipv6CidrBlock: ‘string’

    Ipv6IpamPoolId: ‘string’ Ipv6NetmaskLength: ‘integer’ Ipv6CidrBlockNetworkBorderGroup: ‘string’ AmazonProvidedIpv6CidrBlock: True|False

  • instance_tenancy: ‘default’|’dedicated’|’host’

  • tags: - Key: ‘string’

    Value: ‘string’

  • enable_dns_support: ‘Boolean’

  • enable_dns_hostnames: ‘Boolean’

Returns:

Dict[str, Any]

Examples

vpc-01234672f3336db8:
  aws.ec2.vpc.present:
  - cidr_block_association_set:
    - CidrBlock: 10.1.150.0/28
  - instance_tenancy: default
  - enable_dns_support: True
  - enable_dns_hostnames: False
  - tags:
    - Key: Name
      Value: vpc-name
    - Key: vpc-tag-key-2
      Value: vpc-tag-value-2
async idem_aws.states.aws.ec2.vpc.absent(hub, ctx, name: str, resource_id: str = None) Dict[str, Any][source]#

Autogenerated function

Deletes the specified VPC. You must detach or delete all gateways and resources that are associated with the VPC before you can delete it. For example, you must terminate all instances running in the VPC, delete all security groups associated with the VPC (except the default one), delete all route tables associated with the VPC (except the default one), and so on.

Parameters:
  • name (str) – The Idem name of the VPC.

  • resource_id (str, Optional) – AWS VPC ID. Idem automatically considers this resource being absent if this field is not specified.

Returns:

Dict[str, Any]

Examples

vpc-01234672f3336db8:
  aws.ec2.vpc.absent:
    - resource_id: value
async idem_aws.states.aws.ec2.vpc.describe(hub, ctx) Dict[str, Dict[str, Any]][source]#