torvo-aws#

An AWS module that provides simplified infrastructure as code.

  • All resources should have predictable identifiers, this removes the need for additional state storage and maintenance.

  • Actions should be primarily idempotent, this simplifies the amount of code required to manage the infrastructure.

  • All functions relating to a resource use the same interface and only access the properties as needed, this minimises the complexity of managing properties.

Usage#

Install

pip install torvo-aws

Import

import aws

Use

aws.session.create()

Notes

  • We only provide the latest version, don't pin to any specific version.

  • For any missing details refer to Boto3

Functions#

aws.session.create(properties)

Create a Session to access the AWS Environment.

aws.vpc.create(session, properties)

Create a VPC with the Name tag.

aws.vpc.read(session, properties)

Read a VPC by the Name tag or return None.

aws.vpc.update(session, properties)

Update a VPC with the Name tag.

aws.vpc.delete(session, properties)

Delete a VPC with the Name tag.

aws.vpc.put(session, properties)

Create or Update a VPC with the Name tag.

aws.subnet.create(session, properties)

Create a Subnet with the Name tag.

aws.subnet.read(session, properties)

Read a Subnet by the Name tag or return None.

aws.subnet.update(session, properties)

Update a Subnet with the Name tag.

aws.subnet.delete(session, properties)

Delete a Subnet with the Name tag.

aws.subnet.put(session, properties)

Create or Update a Subnet with the Name tag.

AWS Session#

aws.session.create(properties)#

Create a Session to access the AWS Environment.

Properties
{
'aws_access_key_id' = 'string',
'aws_secret_access_key' = 'string',
'aws_session_token' = 'string',
'region_name' = 'string',
'botocore_session' = botocore.session.Session,
'profile_name' = 'string'
}

AWS VPC#

aws.vpc.create(session, properties)#

Create a VPC with the Name tag.

aws.vpc.read(session, properties)#

Read a VPC by the Name tag or return None.

aws.vpc.update(session, properties)#

Update a VPC with the Name tag.

aws.vpc.delete(session, properties)#

Delete a VPC with the Name tag.

aws.vpc.put(session, properties)#

Create or Update a VPC with the Name tag.

Session
aws.session.create()
Properties
{
'Name' = 'string',
'CidrBlock' = 'string',
'AmazonProvidedIpv6CidrBlock' = True|False,
'Ipv6Pool' = 'string',
'Ipv6CidrBlock' = 'string',
'Ipv4IpamPoolId' = 'string',
'Ipv4NetmaskLength' = 123,
'Ipv6IpamPoolId' = 'string',
'Ipv6NetmaskLength' = 123,
'InstanceTenancy' = 'default'|'dedicated'|'host',
'Ipv6CidrBlockNetworkBorderGroup' = 'string',
'Tags' = [
{
'Key': 'string',
'Value': 'string'
}
]
'EnableDnsSupport': True|False,
'EnableDnsHostnames': True|False
}
Response
{
'CidrBlock': 'string',
'DhcpOptionsId': 'string',
'State': 'pending'|'available',
'VpcId': 'string',
'OwnerId': 'string',
'InstanceTenancy': 'default'|'dedicated'|'host',
'Ipv6CidrBlockAssociationSet': [
{
'AssociationId': 'string',
'Ipv6CidrBlock': 'string',
'Ipv6CidrBlockState': {
'State': 'associating'|'associated'|'disassociating'|'disassociated'|'failing'|'failed',
'StatusMessage': 'string'
},
'NetworkBorderGroup': 'string',
'Ipv6Pool': 'string'
},
],
'CidrBlockAssociationSet': [
{
'AssociationId': 'string',
'CidrBlock': 'string',
'CidrBlockState': {
'State': 'associating'|'associated'|'disassociating'|'disassociated'|'failing'|'failed',
'StatusMessage': 'string'
}
},
],
'IsDefault': True|False,
'Tags': [
{
'Key': 'string',
'Value': 'string'
}
]
'EnableDnsSupport': True|False,
'EnableDnsHostnames': True|False
}

AWS Subnet#

aws.subnet.create(session, properties)#

Create a Subnet with the Name tag.

aws.subnet.read(session, properties)#

Read a Subnet by the Name tag or return None.

aws.subnet.update(session, properties)#

Update a Subnet with the Name tag.

aws.subnet.delete(session, properties)#

Delete a Subnet with the Name tag.

aws.subnet.put(session, properties)#

Create or Update a Subnet with the Name tag.

Session
aws.session.create()
Properties
{
'Tags': [
{
'Key': 'string',
'Value': 'string'
}
],
'AvailabilityZone': 'string',
'AvailabilityZoneId': 'string',
'CidrBlock': 'string',
'Ipv6CidrBlock': 'string',
'OutpostArn': 'string',
'VpcId': 'string',
'Ipv6Native': True|False,
'AssignIpv6AddressOnCreation': True|False,
'MapPublicIpOnLaunch': True|False,
'MapCustomerOwnedIpOnLaunch': True|False,
'CustomerOwnedIpv4Pool': 'string',
'EnableDns64': 'Value': True|False,
'PrivateDnsHostnameTypeOnLaunch': 'ip-name'|'resource-name',
'EnableResourceNameDnsARecordOnLaunch': True|False,
'EnableResourceNameDnsAAAARecordOnLaunch': True|False,
'EnableLniAtDeviceIndex': 123,
'DisableLniAtDeviceIndex': True|False,
}
Response
{
'AvailabilityZone': 'string',
'AvailabilityZoneId': 'string',
'AvailableIpAddressCount': 123,
'CidrBlock': 'string',
'DefaultForAz': True|False,
'EnableLniAtDeviceIndex': 123,
'MapPublicIpOnLaunch': True|False,
'MapCustomerOwnedIpOnLaunch': True|False,
'CustomerOwnedIpv4Pool': 'string',
'State': 'pending'|'available',
'SubnetId': 'string',
'VpcId': 'string',
'OwnerId': 'string',
'AssignIpv6AddressOnCreation': True|False,
'Ipv6CidrBlockAssociationSet': [
{
'AssociationId': 'string',
'Ipv6CidrBlock': 'string',
'Ipv6CidrBlockState': {
'State': 'associating'|'associated'|'disassociating'|'disassociated'|'failing'|'failed',
'StatusMessage': 'string'
}
},
],
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'SubnetArn': 'string',
'OutpostArn': 'string',
'EnableDns64': True|False,
'Ipv6Native': True|False,
'PrivateDnsNameOptionsOnLaunch': {
'HostnameType': 'ip-name'|'resource-name',
'EnableResourceNameDnsARecord': True|False,
'EnableResourceNameDnsAAAARecord': True|False
}
}