boto3_vpc¶
Connection module for Amazon VPC using boto3.¶
Renamed from
boto_vpctoboto3_vpcand rewritten to use the boto3 EC2 client API directly viasaltext.boto3.utils.boto3mod. The legacy boto2 code path has been removed.
- depends:
boto3 >= 1.28.0
botocore >= 1.31.0
- configuration:
This module accepts explicit VPC credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API and no further configuration is necessary. More information available at:
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html
If IAM roles are not used you need to specify them either in the minion’s config file or as a profile. For example, to specify them in the minion’s config file:
vpc.keyid: GKTADJGHEIQSXMKKRBJ08H
vpc.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
A region may also be specified in the configuration:
vpc.region: us-east-1
It’s also possible to specify key, keyid and region via a profile, either as a passed in dict, or as a string to pull from pillars or minion config:
myprofile:
keyid: GKTADJGHEIQSXMKKRBJ08H
key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
region: us-east-1
Added in version 1.0.0.
- saltext.boto3.modules.boto3_vpc.__virtual__()[source]¶
Only load if boto3 is available. Minimum version is enforced via the project’s
pyproject.tomldependency declaration.
- saltext.boto3.modules.boto3_vpc.get_id(name=None, cidr=None, tags=None, region=None, key=None, keyid=None, profile=None)[source]¶
Return the id of the VPC matching the supplied filters.
CLI Example:
salt myminion boto3_vpc.get_id myvpc
- saltext.boto3.modules.boto3_vpc.exists(vpc_id=None, name=None, cidr=None, tags=None, region=None, key=None, keyid=None, profile=None)[source]¶
Return
{"exists": True}if a VPC matching the supplied filters exists.CLI Example:
salt myminion boto3_vpc.exists myvpc
- saltext.boto3.modules.boto3_vpc.check_vpc(vpc_id=None, vpc_name=None, region=None, key=None, keyid=None, profile=None)[source]¶
Return the VPC id if a VPC with the supplied id or name exists, else
None.CLI Example:
salt myminion boto3_vpc.check_vpc vpc_name=myvpc
- saltext.boto3.modules.boto3_vpc.create(cidr_block, instance_tenancy=None, vpc_name=None, enable_dns_support=None, enable_dns_hostnames=None, tags=None, region=None, key=None, keyid=None, profile=None)[source]¶
Create a VPC with the given CIDR block.
CLI Example:
salt myminion boto3_vpc.create '10.0.0.0/24'
- saltext.boto3.modules.boto3_vpc.delete(vpc_id=None, name=None, vpc_name=None, tags=None, region=None, key=None, keyid=None, profile=None)[source]¶
Delete a VPC by id or name.
CLI Example:
salt myminion boto3_vpc.delete vpc_id='vpc-6b1fe402' salt myminion boto3_vpc.delete vpc_name='myvpc'
- saltext.boto3.modules.boto3_vpc.describe(vpc_id=None, vpc_name=None, region=None, key=None, keyid=None, profile=None)[source]¶
Describe a VPC’s properties. If neither id nor name is provided the default VPC (if any) is described.
CLI Example:
salt myminion boto3_vpc.describe vpc_id=vpc-123456
- saltext.boto3.modules.boto3_vpc.describe_vpcs(vpc_id=None, name=None, cidr=None, tags=None, region=None, key=None, keyid=None, profile=None)[source]¶
Describe all VPCs matching the supplied filters.
CLI Example:
salt myminion boto3_vpc.describe_vpcs
- saltext.boto3.modules.boto3_vpc.get_resource_id(resource, name=None, resource_id=None, region=None, key=None, keyid=None, profile=None)[source]¶
Return
{"id": "..."}for a VPC resource looked up by name or id.Currently supported
resourcevalues:vpc,subnet,dhcp_options.CLI Example:
salt myminion boto3_vpc.get_resource_id subnet mysubnet
- saltext.boto3.modules.boto3_vpc.resource_exists(resource, name=None, resource_id=None, tags=None, region=None, key=None, keyid=None, profile=None)[source]¶
Return
{"exists": True}if a resource ofresourcematching the supplied filters exists.CLI Example:
salt myminion boto3_vpc.resource_exists subnet name=mysubnet
- saltext.boto3.modules.boto3_vpc.create_subnet(vpc_id=None, cidr_block=None, vpc_name=None, availability_zone=None, subnet_name=None, tags=None, region=None, key=None, keyid=None, profile=None, auto_assign_public_ipv4=False)[source]¶
Create a subnet inside an existing VPC.
CLI Example:
salt myminion boto3_vpc.create_subnet vpc_name=myvpc \ subnet_name=mysubnet cidr_block=10.0.0.0/25
- saltext.boto3.modules.boto3_vpc.delete_subnet(subnet_id=None, subnet_name=None, region=None, key=None, keyid=None, profile=None)[source]¶
Delete a subnet by id or name.
CLI Example:
salt myminion boto3_vpc.delete_subnet 'subnet-6a1fe403'
- saltext.boto3.modules.boto3_vpc.subnet_exists(subnet_id=None, name=None, subnet_name=None, cidr=None, tags=None, zones=None, region=None, key=None, keyid=None, profile=None)[source]¶
Return
{"exists": True}when a subnet matching the filters exists.CLI Example:
salt myminion boto3_vpc.subnet_exists subnet_id='subnet-6a1fe403'
- saltext.boto3.modules.boto3_vpc.get_subnet_association(subnets, region=None, key=None, keyid=None, profile=None)[source]¶
Return the VPC id (or list of VPC ids) associated with the given subnet id or list of subnet ids.
CLI Example:
salt myminion boto3_vpc.get_subnet_association subnet-61b47516
- saltext.boto3.modules.boto3_vpc.describe_subnet(subnet_id=None, subnet_name=None, region=None, key=None, keyid=None, profile=None)[source]¶
Describe a single subnet by id or name.
CLI Example:
salt myminion boto3_vpc.describe_subnet subnet_id=subnet-123456
- saltext.boto3.modules.boto3_vpc.describe_subnets(subnet_ids=None, subnet_names=None, vpc_id=None, cidr=None, region=None, key=None, keyid=None, profile=None)[source]¶
Describe subnets matching the supplied filters.
CLI Example:
salt myminion boto3_vpc.describe_subnets vpc_id=vpc-123456
- saltext.boto3.modules.boto3_vpc.create_dhcp_options(domain_name=None, domain_name_servers=None, ntp_servers=None, netbios_name_servers=None, netbios_node_type=None, dhcp_options_name=None, tags=None, vpc_id=None, vpc_name=None, region=None, key=None, keyid=None, profile=None)[source]¶
Create a DHCP options set, optionally associating it with an existing VPC.
CLI Example:
salt myminion boto3_vpc.create_dhcp_options domain_name='example.com' \ domain_name_servers='[1.2.3.4]' vpc_name='myvpc'
- saltext.boto3.modules.boto3_vpc.get_dhcp_options(dhcp_options_name=None, dhcp_options_id=None, region=None, key=None, keyid=None, profile=None)[source]¶
Return the configured options for the named DHCP options set.
CLI Example:
salt myminion boto3_vpc.get_dhcp_options 'myfunnydhcpoptionsname'
- saltext.boto3.modules.boto3_vpc.delete_dhcp_options(dhcp_options_id=None, dhcp_options_name=None, region=None, key=None, keyid=None, profile=None)[source]¶
Delete a DHCP options set by id or name.
CLI Example:
salt myminion boto3_vpc.delete_dhcp_options 'dopt-b6a247df'
- saltext.boto3.modules.boto3_vpc.associate_dhcp_options_to_vpc(dhcp_options_id, vpc_id=None, vpc_name=None, region=None, key=None, keyid=None, profile=None)[source]¶
Associate a DHCP options set with a VPC.
CLI Example:
salt myminion boto3_vpc.associate_dhcp_options_to_vpc 'dopt-a0bl34pp' 'vpc-6b1fe402'
- saltext.boto3.modules.boto3_vpc.dhcp_options_exists(dhcp_options_id=None, name=None, dhcp_options_name=None, tags=None, region=None, key=None, keyid=None, profile=None)[source]¶
Return
{"exists": True}if a DHCP options set matching the filters exists.CLI Example:
salt myminion boto3_vpc.dhcp_options_exists dhcp_options_id='dopt-a0bl34pp'
- saltext.boto3.modules.boto3_vpc.create_internet_gateway(internet_gateway_name=None, vpc_id=None, vpc_name=None, tags=None, region=None, key=None, keyid=None, profile=None)[source]¶
Create an internet gateway, optionally attaching it to an existing VPC.
CLI Example:
salt myminion boto3_vpc.create_internet_gateway \ internet_gateway_name=myigw vpc_name=myvpc
- saltext.boto3.modules.boto3_vpc.delete_internet_gateway(internet_gateway_id=None, internet_gateway_name=None, detach=False, region=None, key=None, keyid=None, profile=None)[source]¶
Delete an internet gateway by id or name. If
detachisTrue, any VPC attachment is detached first.CLI Example:
salt myminion boto3_vpc.delete_internet_gateway internet_gateway_id=igw-1a2b3c
- saltext.boto3.modules.boto3_vpc.nat_gateway_exists(nat_gateway_id=None, subnet_id=None, subnet_name=None, vpc_id=None, vpc_name=None, states=('pending', 'available'), region=None, key=None, keyid=None, profile=None)[source]¶
Return
Trueif a NAT gateway matching the filter criteria exists.CLI Example:
salt myminion boto3_vpc.nat_gateway_exists nat_gateway_id='nat-03b02643b43216fe7'
- saltext.boto3.modules.boto3_vpc.describe_nat_gateways(nat_gateway_id=None, subnet_id=None, subnet_name=None, vpc_id=None, vpc_name=None, states=('pending', 'available'), region=None, key=None, keyid=None, profile=None)[source]¶
Return a list of NAT gateway descriptions matching the selection criteria.
CLI Example:
salt myminion boto3_vpc.describe_nat_gateways subnet_id='subnet-5b05942d'
- saltext.boto3.modules.boto3_vpc.create_nat_gateway(subnet_id=None, subnet_name=None, allocation_id=None, region=None, key=None, keyid=None, profile=None)[source]¶
Create a NAT gateway inside an existing subnet. If
allocation_idis not supplied a new Elastic IP is allocated and used.CLI Example:
salt myminion boto3_vpc.create_nat_gateway subnet_name=mysubnet
- saltext.boto3.modules.boto3_vpc.delete_nat_gateway(nat_gateway_id, release_eips=False, region=None, key=None, keyid=None, profile=None, wait_for_delete=False, wait_for_delete_retries=5)[source]¶
Delete a NAT gateway by id, optionally releasing any associated EIPs.
CLI Example:
salt myminion boto3_vpc.delete_nat_gateway nat_gateway_id=nat-1a2b3c
- saltext.boto3.modules.boto3_vpc.create_customer_gateway(vpn_connection_type, ip_address, bgp_asn, customer_gateway_name=None, tags=None, region=None, key=None, keyid=None, profile=None)[source]¶
Create a customer gateway.
CLI Example:
salt myminion boto3_vpc.create_customer_gateway 'ipsec.1' '12.1.2.3' 65534
- saltext.boto3.modules.boto3_vpc.delete_customer_gateway(customer_gateway_id=None, customer_gateway_name=None, region=None, key=None, keyid=None, profile=None)[source]¶
Delete a customer gateway by id or name.
CLI Example:
salt myminion boto3_vpc.delete_customer_gateway 'cgw-b6a247df'
- saltext.boto3.modules.boto3_vpc.customer_gateway_exists(customer_gateway_id=None, customer_gateway_name=None, region=None, key=None, keyid=None, profile=None)[source]¶
Return
{"exists": True}if the given customer gateway exists.CLI Example:
salt myminion boto3_vpc.customer_gateway_exists cgw-b6a247df
- saltext.boto3.modules.boto3_vpc.create_network_acl(vpc_id=None, vpc_name=None, network_acl_name=None, subnet_id=None, subnet_name=None, tags=None, region=None, key=None, keyid=None, profile=None)[source]¶
Create a network ACL within a VPC, optionally associating it with a subnet.
CLI Example:
salt myminion boto3_vpc.create_network_acl 'vpc-6b1fe402'
- saltext.boto3.modules.boto3_vpc.delete_network_acl(network_acl_id=None, network_acl_name=None, disassociate=False, region=None, key=None, keyid=None, profile=None)[source]¶
Delete a network ACL by id or name. When
disassociateisTrueany existing subnet association is replaced with the VPC’s default ACL before deletion.CLI Example:
salt myminion boto3_vpc.delete_network_acl network_acl_id='acl-5fb85d36'
- saltext.boto3.modules.boto3_vpc.network_acl_exists(network_acl_id=None, name=None, network_acl_name=None, tags=None, region=None, key=None, keyid=None, profile=None)[source]¶
Return
{"exists": True}if the network ACL exists.CLI Example:
salt myminion boto3_vpc.network_acl_exists network_acl_id='acl-5fb85d36'
- saltext.boto3.modules.boto3_vpc.associate_network_acl_to_subnet(network_acl_id=None, subnet_id=None, network_acl_name=None, subnet_name=None, region=None, key=None, keyid=None, profile=None)[source]¶
Associate a network ACL with a subnet by replacing the subnet’s current network ACL association.
CLI Example:
salt myminion boto3_vpc.associate_network_acl_to_subnet \ network_acl_id='acl-5fb85d36' subnet_id='subnet-6a1fe403'
- saltext.boto3.modules.boto3_vpc.disassociate_network_acl(subnet_id=None, vpc_id=None, subnet_name=None, vpc_name=None, region=None, key=None, keyid=None, profile=None)[source]¶
Disassociate the network ACL from a subnet by replacing its association with the VPC’s default network ACL.
CLI Example:
salt myminion boto3_vpc.disassociate_network_acl 'subnet-6a1fe403'
- saltext.boto3.modules.boto3_vpc.create_network_acl_entry(network_acl_id=None, rule_number=None, protocol=None, rule_action=None, cidr_block=None, egress=None, network_acl_name=None, icmp_code=None, icmp_type=None, port_range_from=None, port_range_to=None, region=None, key=None, keyid=None, profile=None)[source]¶
Create a network ACL entry.
CLI Example:
salt myminion boto3_vpc.create_network_acl_entry 'acl-5fb85d36' 32767 \ 'all' 'deny' '0.0.0.0/0' egress=True
- saltext.boto3.modules.boto3_vpc.replace_network_acl_entry(network_acl_id=None, rule_number=None, protocol=None, rule_action=None, cidr_block=None, egress=None, network_acl_name=None, icmp_code=None, icmp_type=None, port_range_from=None, port_range_to=None, region=None, key=None, keyid=None, profile=None)[source]¶
Replace a network ACL entry.
CLI Example:
salt myminion boto3_vpc.replace_network_acl_entry 'acl-5fb85d36' 32767 \ 'all' 'deny' '0.0.0.0/0' egress=True
- saltext.boto3.modules.boto3_vpc.delete_network_acl_entry(network_acl_id=None, rule_number=None, egress=None, network_acl_name=None, region=None, key=None, keyid=None, profile=None)[source]¶
Delete a network ACL entry.
CLI Example:
salt myminion boto3_vpc.delete_network_acl_entry 'acl-5fb85d36' 32767
- saltext.boto3.modules.boto3_vpc.create_route_table(vpc_id=None, vpc_name=None, route_table_name=None, tags=None, region=None, key=None, keyid=None, profile=None)[source]¶
Create a route table in the specified VPC.
CLI Example:
salt myminion boto3_vpc.create_route_table vpc_name='myvpc' \ route_table_name='myroutetable'
- saltext.boto3.modules.boto3_vpc.delete_route_table(route_table_id=None, route_table_name=None, region=None, key=None, keyid=None, profile=None)[source]¶
Delete a route table by id or name.
CLI Example:
salt myminion boto3_vpc.delete_route_table route_table_id='rtb-1f382e7d'
- saltext.boto3.modules.boto3_vpc.route_table_exists(route_table_id=None, name=None, route_table_name=None, tags=None, region=None, key=None, keyid=None, profile=None)[source]¶
Return
{"exists": True}if the route table exists.CLI Example:
salt myminion boto3_vpc.route_table_exists route_table_id='rtb-1f382e7d'
- saltext.boto3.modules.boto3_vpc.describe_route_tables(route_table_id=None, route_table_name=None, vpc_id=None, tags=None, region=None, key=None, keyid=None, profile=None)[source]¶
Return a list of route tables matching the filter criteria.
CLI Example:
salt myminion boto3_vpc.describe_route_tables vpc_id='vpc-a6a9efc3'
- saltext.boto3.modules.boto3_vpc.route_exists(destination_cidr_block, route_table_name=None, route_table_id=None, gateway_id=None, instance_id=None, interface_id=None, tags=None, region=None, key=None, keyid=None, profile=None, vpc_peering_connection_id=None, nat_gateway_id=None)[source]¶
Return
{"exists": True}if a matching route is present in the specified route table.CLI Example:
salt myminion boto3_vpc.route_exists destination_cidr_block='10.0.0.0/20' \ gateway_id='local' route_table_name='test'
- saltext.boto3.modules.boto3_vpc.associate_route_table(route_table_id=None, subnet_id=None, route_table_name=None, subnet_name=None, region=None, key=None, keyid=None, profile=None)[source]¶
Associate a route table with a subnet.
CLI Example:
salt myminion boto3_vpc.associate_route_table 'rtb-1f382e7d' 'subnet-6a1fe403'
- saltext.boto3.modules.boto3_vpc.disassociate_route_table(association_id, region=None, key=None, keyid=None, profile=None)[source]¶
Disassociate a route table.
CLI Example:
salt myminion boto3_vpc.disassociate_route_table 'rtbassoc-d8ccddba'
- saltext.boto3.modules.boto3_vpc.replace_route_table_association(association_id, route_table_id, region=None, key=None, keyid=None, profile=None)[source]¶
Replace a route table association with a new route table.
CLI Example:
salt myminion boto3_vpc.replace_route_table_association 'rtbassoc-d8ccddba' 'rtb-1f382e7d'
- saltext.boto3.modules.boto3_vpc.create_route(route_table_id=None, destination_cidr_block=None, route_table_name=None, gateway_id=None, internet_gateway_name=None, instance_id=None, interface_id=None, vpc_peering_connection_id=None, vpc_peering_connection_name=None, region=None, key=None, keyid=None, profile=None, nat_gateway_id=None, nat_gateway_subnet_name=None, nat_gateway_subnet_id=None)[source]¶
Create a route in a route table.
CLI Example:
salt myminion boto3_vpc.create_route 'rtb-1f382e7d' '10.0.0.0/16' gateway_id='vgw-a1b2c3'
- saltext.boto3.modules.boto3_vpc.delete_route(route_table_id=None, destination_cidr_block=None, route_table_name=None, region=None, key=None, keyid=None, profile=None)[source]¶
Delete a route from a route table.
CLI Example:
salt myminion boto3_vpc.delete_route 'rtb-1f382e7d' '10.0.0.0/16'
- saltext.boto3.modules.boto3_vpc.replace_route(route_table_id=None, destination_cidr_block=None, route_table_name=None, gateway_id=None, instance_id=None, interface_id=None, region=None, key=None, keyid=None, profile=None, vpc_peering_connection_id=None, nat_gateway_id=None)[source]¶
Replace an existing route in a route table.
CLI Example:
salt myminion boto3_vpc.replace_route 'rtb-1f382e7d' '10.0.0.0/16' gateway_id='vgw-a1b2c3'
- saltext.boto3.modules.boto3_vpc.request_vpc_peering_connection(requester_vpc_id=None, requester_vpc_name=None, peer_vpc_id=None, peer_vpc_name=None, name=None, peer_owner_id=None, peer_region=None, region=None, key=None, keyid=None, profile=None, dry_run=False)[source]¶
Request a VPC peering connection between two VPCs.
CLI Example:
salt myminion boto3_vpc.request_vpc_peering_connection vpc-4a3e622e vpc-be82e9da \ name=my_vpc_connection
- saltext.boto3.modules.boto3_vpc.describe_vpc_peering_connection(name, region=None, key=None, keyid=None, profile=None)[source]¶
Return any VPC peering connection ids for the given VPC peering connection name that are
active,pending-acceptanceorprovisioning.CLI Example:
salt myminion boto3_vpc.describe_vpc_peering_connection salt-vpc
- saltext.boto3.modules.boto3_vpc.accept_vpc_peering_connection(conn_id='', name='', region=None, key=None, keyid=None, profile=None, dry_run=False)[source]¶
Accept a pending VPC peering connection request.
CLI Example:
salt myminion boto3_vpc.accept_vpc_peering_connection name=salt-vpc
- saltext.boto3.modules.boto3_vpc.delete_vpc_peering_connection(conn_id=None, conn_name=None, region=None, key=None, keyid=None, profile=None, dry_run=False)[source]¶
Delete a VPC peering connection by id or name.
CLI Example:
salt myminion boto3_vpc.delete_vpc_peering_connection conn_name=salt-vpc
- saltext.boto3.modules.boto3_vpc.is_peering_connection_pending(conn_id=None, conn_name=None, region=None, key=None, keyid=None, profile=None)[source]¶
Return
Trueif the VPC peering connection is in thepending-acceptancestate.CLI Example:
salt myminion boto3_vpc.is_peering_connection_pending conn_name=salt-vpc
- saltext.boto3.modules.boto3_vpc.peering_connection_pending_from_vpc(conn_id=None, conn_name=None, vpc_id=None, vpc_name=None, region=None, key=None, keyid=None, profile=None)[source]¶
Return
Trueif a VPC peering connection is pending from the given requester VPC.CLI Example:
salt myminion boto3_vpc.peering_connection_pending_from_vpc conn_name=salt-vpc \ vpc_name=myvpc