pycloudlib.ec2.vpc module

Used to define custom Virtual Private Clouds (VPC).

class pycloudlib.ec2.vpc.VPC(vpc)[source]

Bases: object

Virtual Private Cloud class proxy for AWS VPC resource.

__init__(vpc)[source]

Create a VPC proxy instance for an AWS VPC resource.

Parameters:vpc_id – Optional ID of existing VPC object to return
classmethod create(resource, name, ipv4_cidr='192.168.1.0/20')[source]

Create a pycloudlib.ec2.VPC proxy for an AWS VPC resource.

Parameters:
  • resource – EC2 resource client
  • name – String for the name or tag of the VPC
  • ipv4_cidr – String of the CIDR for IPV4 subnet to associate with the VPC.
Returns:

pycloudlib.ec2.VPC instance

delete()[source]

Terminate all associated instances and delete an entire VPC.

classmethod from_existing(resource, vpc_id)[source]

Wrap an existing boto3 EC2 VPC resource given the vpc_id.

Parameters:
  • resource – EC2 resource client
  • vpc_id – String for an existing VPC id.
Returns:

pycloudlib.ec2.VPC instance

id

ID of the VPC.

name

Name of the VPC from tags.