25
Sky Documentation Release 0.1 LibreTees, LLC June 24, 2015

Sky Documentation - media.readthedocs.org file• security_groups (list) – An optional list of SecurityGroup objects that the EC2 Instance will join. – See also: sky.compute.create_security_group()

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Sky Documentation - media.readthedocs.org file• security_groups (list) – An optional list of SecurityGroup objects that the EC2 Instance will join. – See also: sky.compute.create_security_group()

Sky DocumentationRelease 0.1

LibreTees, LLC

June 24, 2015

Page 2: Sky Documentation - media.readthedocs.org file• security_groups (list) – An optional list of SecurityGroup objects that the EC2 Instance will join. – See also: sky.compute.create_security_group()
Page 3: Sky Documentation - media.readthedocs.org file• security_groups (list) – An optional list of SecurityGroup objects that the EC2 Instance will join. – See also: sky.compute.create_security_group()

Contents

1 sky – Main package 31.1 sky.compute – Amazon EC2 Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.2 sky.database – Amazon RDS Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91.3 sky.networking – Amazon VPC Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111.4 sky.security – Amazon IAM Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141.5 sky.storage – Amazon S3 Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151.6 sky.utils – Sky Utility Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

2 Indices and tables 17

Python Module Index 19

i

Page 4: Sky Documentation - media.readthedocs.org file• security_groups (list) – An optional list of SecurityGroup objects that the EC2 Instance will join. – See also: sky.compute.create_security_group()

ii

Page 5: Sky Documentation - media.readthedocs.org file• security_groups (list) – An optional list of SecurityGroup objects that the EC2 Instance will join. – See also: sky.compute.create_security_group()

Sky Documentation, Release 0.1

Contents:

Contents 1

Page 6: Sky Documentation - media.readthedocs.org file• security_groups (list) – An optional list of SecurityGroup objects that the EC2 Instance will join. – See also: sky.compute.create_security_group()

Sky Documentation, Release 0.1

2 Contents

Page 7: Sky Documentation - media.readthedocs.org file• security_groups (list) – An optional list of SecurityGroup objects that the EC2 Instance will join. – See also: sky.compute.create_security_group()

CHAPTER 1

sky – Main package

1.1 sky.compute – Amazon EC2 Services

sky.compute.allocate_address()Allocate a Static (Elastic) IP Address.

Return type boto.ec2.address.Address

Returns A Static IP Address.

sky.compute.connect_ec2()Connect to the Amazon Elastic Compute Cloud (Amazon EC2) service.

Return type boto.ec2.connection.EC2Connection

Returns An EC2Connection object.

sky.compute.create_instance(subnet, name=None, role=None, security_groups=None,script=None, instance_profile=None, os=’ubuntu’, image_id=None,key_name=None, internet_addressable=False)

Create an EC2 Instance.

Parameters

• subnet (boto.vpc.subnet.Subnet) – The Subnet that the EC2 Instance will becreated in.

– See also: sky.networking.create_subnet().

• name (str) – An optional name for the EC2 Instance. A name will be generated from thecurrent project name, if one is not specified.

• role (str) – An optional role for the EC2 Instance. This string will be added to the EC2Instance’s tags, if specified.

• security_groups (list) – An optional list of SecurityGroup objects that the EC2Instance will join.

– See also: sky.compute.create_security_group().

• script (str) – An optional user-data script that is executed when the EC2 Instance is runfor the first time.

– See also: sky.utils.get_script().

• instance_profile (boto.jsonresponse.Element) – An optional IAM In-stance Profile for the EC2 Instance. This grants permission for an EC2 Instance to performinteractions with other AWS resources.

3

Page 8: Sky Documentation - media.readthedocs.org file• security_groups (list) – An optional list of SecurityGroup objects that the EC2 Instance will join. – See also: sky.compute.create_security_group()

Sky Documentation, Release 0.1

– See also: sky.security.create_role().

• os (str) – The OS that will run on the EC2 Instance. For convenience, amazon-linux,redhat, suse, and ubuntu are available.

• image_id (str) – The Amazon Machine Image (AMI) that will run on the EC2 Instance.Note that if both the os and image_id parameters are specified, the image_id parameterwill take precedence.

• key_name (str) – An optional Amazon EC2 Key Pair name. This should be specified ifremote access to the server is desired.

• internet_addressable (bool) – Specifies whether the EC2 Instance will be acces-sible via the Internet. If set to True, a Public IP address will be associated to the EC2Instance. By default, an EC2 Instance is not Internet-addressable.

Return type boto.ec2.instance.Instance

Returns An EC2 Instance.

sky.compute.create_instances(subnets, role=None, security_groups=None, script=None,instance_profile=None, os=’ubuntu’, image_id=None,key_name=None, internet_addressable=False)

Create EC2 Instances across subnets.

Parameters

• subnets (list) – A list of Subnet objects that the EC2 Instances will be created in.

– See also: sky.networking.create_subnets().

• role (str) – An optional role for the EC2 Instance. This string will be added to the EC2Instance’s tags, if specified.

• security_groups (list) – An optional list of SecurityGroup objects that the EC2Instances will join.

– See also: sky.compute.create_security_group().

• script (str) – An optional user-data script that is executed when the EC2 Instance is runfor the first time.

– See also: sky.utils.get_script().

• instance_profile (boto.jsonresponse.Element) – An optional IAM In-stance Profile for the EC2 Instance. This grants permission for an EC2 Instance to performinteractions with other AWS resources.

– See also: sky.security.create_role().

• os (str) – The OS that will run on the EC2 Instance. For convenience, amazon-linux,redhat, suse, and ubuntu are available.

• image_id (str) – The Amazon Machine Image (AMI) that will run on the EC2 Instance.Note that if both the os and image_id parameters are specified, the image_id parameterwill take precedence.

• key_name (str) – An optional Amazon EC2 Key Pair name. This should be specified ifremote access to the server is desired.

• internet_addressable (bool) – Specifies whether the EC2 Instances will be acces-sible via the Internet. If set to True, a Public IP address will be associated to the EC2Instances. By default, the EC2 Instances are not Internet-addressable.

Return type list

4 Chapter 1. sky – Main package

Page 9: Sky Documentation - media.readthedocs.org file• security_groups (list) – An optional list of SecurityGroup objects that the EC2 Instance will join. – See also: sky.compute.create_security_group()

Sky Documentation, Release 0.1

Returns A list of EC2 Instance objects.

sky.compute.create_load_balancer(subnets, name=None, security_groups=None,ssl_certificate=None)

Create an Elastic Load Balancer (ELB).

Parameters

• subnets (list) – A list of Subnet objects that will share inbound traffic.

– See also: sky.networking.create_subnets().

• name (string) – An optional name for the Load Balancer. A name will be generated fromthe current project name, if one is not specified.

• security_groups (list) – An optional list of SecurityGroup objects that the LoadBalancer will join.

– See also: sky.compute.create_security_group().

• ssl_certificate (string) – The Amazon Resource Name (ARN) of an uploaded SSLCertificate. This is required only if HTTPS/SSL load balancer listeners are desired.

– See also: sky.security.upload_ssl_certificate().

Return type boto.ec2.elb.loadbalancer.LoadBalancer

Returns An Elastic Load Balancer (ELB).

sky.compute.create_nat_instance(public_subnet, private_subnet, name=None, secu-rity_groups=None, image_id=None)

Create a NAT (Network Address Translation) Instance.

Parameters

• public_subnet (boto.vpc.subnet.Subnet) – The subnet that the NAT Instancewill route traffic from.

– See also: sky.networking.create_subnet().

• private_subnet (boto.vpc.subnet.Subnet) – The subnet that the NAT Instancewill route traffic to.

– See also: sky.networking.create_subnet().

• name (str) – An optional name for the NAT Instance. A name will be generated from thecurrent project name, if one is not specified.

• security_groups (list) – An optional list of SecurityGroup objects that the NATInstance will join.

– See also: sky.compute.create_security_group().

• image_id (string) – An optional AMI (Amazon Machine Image) ID that determines theOS and Virtualization Type that the NAT Instance will use. By default, this is the AMI IDreturned by sky.compute.get_nat_image().

Return type boto.ec2.instance.Instance

Returns A NAT Instance.

sky.compute.create_nat_instances(public_subnets, private_subnets, security_groups=None, im-age_id=None)

Create NAT (Network Address Translation) Instances.

Parameters

1.1. sky.compute – Amazon EC2 Services 5

Page 10: Sky Documentation - media.readthedocs.org file• security_groups (list) – An optional list of SecurityGroup objects that the EC2 Instance will join. – See also: sky.compute.create_security_group()

Sky Documentation, Release 0.1

• public_subnets (list) – A list of Subnet objects that the NAT Instances will routetraffic from.

– See also: sky.networking.create_subnets().

• private_subnets (list) – A list of Subnet objects that the NAT Instances will routetraffic to.

– See also: sky.networking.create_subnets().

• security_groups (list) – An optional list of SecurityGroup objects that the NATInstances will join.

– See also: sky.compute.create_security_group().

• image_id (string) – An optional AMI (Amazon Machine Image) ID that determines theOS and Virtualization Type that the NAT Instances will use. By default, this is the AMI IDreturned by sky.compute.get_nat_image().

Return type list

Returns A list of NAT Instance objects.

sky.compute.create_security_group(vpc, name=None, database_backend=None, al-lowed_inbound_traffic=[], allowed_outbound_traffic=[])

Create an Amazon EC2-VPC Security Group.

Parameters

• vpc (boto.vpc.vpc.VPC) – The VPC that the Security Group will join.

• name (str) – An optional name for the EC2-VPC security group. A name will be generatedfrom the current project name, if one is not specified.

• database_backend (string) – An optional database backend. This is intended to beused with application security groups that require outbound traffic to a database.

– Supported database backends: postgresql, mysql, and oracle.

• allowed_inbound_traffic (list) – A list of tuples in the format: (protocol,cidr_block) or (protocol, security_group).

– protocol (string):

* Supported inbound protocols: HTTP, HTTPS, TCP:Port (e.g., TCP:80), andUDP:Port (e.g., UDP:1337).

– cidr_block (string):

* A range of IP addresses from which inbound traffic is allowed.

– security_group (SecurityGroup)

* A SecurityGroup that the inbound traffic originates from.

• allowed_outbound_traffic (list) – A list of tuples in the format: (protocol,cidr_block) or (protocol, security_group).

– protocol (string):

* Supported outbound protocols: HTTP, HTTPS, DNS, TCP:Port (e.g., TCP:80), andUDP:Port (e.g., UDP:1337).

– cidr_block (string):

* A range of IP addresses to which outbound traffic is allowed.

– security_group (SecurityGroup)

6 Chapter 1. sky – Main package

Page 11: Sky Documentation - media.readthedocs.org file• security_groups (list) – An optional list of SecurityGroup objects that the EC2 Instance will join. – See also: sky.compute.create_security_group()

Sky Documentation, Release 0.1

* A SecurityGroup that the outbound traffic is destined to.

Return type boto.ec2.securitygroup.SecurityGroup

Returns An Amazon EC2-VPC Security Group.

sky.compute.delete_instances(instances, attempts=3)Delete EC2 Instances.

Warning: On an EBS-backed instance, the default action is for the root EBS volume to be deleted whenthe instance is terminated. Storage on any local drives will be lost.

Parameters

• instances (list) – A list of EC2 Instance objects that will be deleted.

– See also: sky.compute.create_instances().

• attempts (int) – The number of 10-second attempts to wait before moving on. This is setto 30 seconds (3), by default.

Return type bool

Returns True, if all EC2 Instance objects were deleted. Otherwise, False.

sky.compute.delete_load_balancer(load_balancer)Delete a Load Balancer.

Parameters load_balancer (boto.ec2.elb.loadbalancer.LoadBalancer) – TheLoadBalancer that will be deleted

• See also: sky.compute.create_load_balancer().

Return type bool

Returns True if the LoadBalancer was successfully deleted. Otherwise, False.

sky.compute.delete_security_group(security_group)Delete a Security Group.

Parameters security_group (boto.ec2.securitygroup.SecurityGroup) – TheSecurityGroup that will be deleted.

• See also: sky.compute.create_security_group().

Return type bool

Returns True if the SecurityGroup was successfully deleted. Otherwise, False.

sky.compute.deregister_instances(load_balancer, instances)Deregister EC2 Instances from an Elastic Load Balancer (ELB).

•See also: sky.compute.register_instances() and sky.compute.rotate_instances().

Parameters

• load_balancer (boto.ec2.elb.loadbalancer.LoadBalancer) – TheLoadBalancer that the EC2 Instances will be removed from.

– See also: sky.compute.create_load_balancer().

• instances (list) – A list of EC2 Instance objects that will be deregistered from theElastic Load Balancer (ELB).

– See also: sky.compute.create_instances().

1.1. sky.compute – Amazon EC2 Services 7

Page 12: Sky Documentation - media.readthedocs.org file• security_groups (list) – An optional list of SecurityGroup objects that the EC2 Instance will join. – See also: sky.compute.create_security_group()

Sky Documentation, Release 0.1

sky.compute.get_instances(vpc=None, name=None, role=None, state=’running’)Query EC2 Instances.

•See also: sky.compute.create_instances().

Parameters

• name (str) – Optional. The name of the EC2 Instance that is being queried.

• role (str) – Optional. The role of the EC2 Instance that is being queried.

• state (str) – An optional EC2 Instance state. Valid values are pending, running,shutting-down, terminated, stopping, and stopped. By default, EC2 In-stances in the running state are returned. This can also be specified as a list of states.

Return type list

Returns A list of EC2 Instance objects.

sky.compute.get_nat_image(paravirtual=False)Retrieve the most-recent Amazon Linux NAT AMI from the AWS Marketplace.

Parameters paravirtual (bool) – Specifies whether the NAT AMI virtualization type is par-avirtual or (PV) or hardware virtual machine (HVM). By default, a NAT HVM image will beretrieved.

Return type boto.ec2.image.Image

Returns A NAT Image.

sky.compute.register_instances(load_balancer, instances)Register EC2 Instances with an Elastic Load Balancer (ELB).

•See also: sky.compute.deregister_instances() and sky.compute.rotate_instances().

Parameters

• load_balancer (boto.ec2.elb.loadbalancer.LoadBalancer) – TheLoadBalancer that the EC2 Instances will be registered to.

– See also: sky.compute.create_load_balancer().

• instances (list) – A list of EC2 Instance objects that will be registered to the ElasticLoad Balancer (ELB).

– See also: sky.compute.create_instances().

sky.compute.rotate_instances(load_balancer, instances, terminate_outgoing_instances=True)Replace old EC2 Instances with new EC2 Instances from behind an Elastic Load Balancer (ELB).

This can be used to carry out seamless (blue-green) deployments. If EC2 Instances are currently registered tothe ELB, they will be deregistered and optionally terminated only after incoming EC2 Instances pass a HealthCheck.

Parameters

• load_balancer (boto.ec2.elb.loadbalancer.LoadBalancer) – TheLoadBalancer that the EC2 Instances will be registered to or removed from.

– See also: sky.compute.create_load_balancer().

• instances (list) – A list of EC2 Instance objects that will be registered to the ElasticLoad Balancer (ELB).

8 Chapter 1. sky – Main package

Page 13: Sky Documentation - media.readthedocs.org file• security_groups (list) – An optional list of SecurityGroup objects that the EC2 Instance will join. – See also: sky.compute.create_security_group()

Sky Documentation, Release 0.1

– See also: sky.compute.create_instances().

• terminate_outgoing_instances (bool) – Specifies whether outgoing EC2 In-stances will be terminated. By default, EC2 Instances will be terminated after they havebeen deregistered from the Elastic Load Balancer (ELB).

– See also: sky.compute.terminate_instances().

sky.compute.terminate_instances(instances)Terminate EC2 Instances.

Warning: On an EBS-backed instance, the default action is for the root EBS volume to be deleted whenthe instance is terminated. Storage on any local drives will be lost.

Parameters instances (list) – A list of EC2 Instance objects

• See also: sky.compute.create_instances().

Return type bool

Returns True, if all EC2 Instance objects were terminated. Otherwise, False.

1.2 sky.database – Amazon RDS Services

sky.database.connect_rds()Connect to the Amazon Relational Database Service (Amazon RDS) service.

Return type boto.rds.RDSConnection

Returns An RDSConnection object.

sky.database.create_database(subnets, name=None, engine=’postgresql’, storage=5, appli-cation_instances=None, application_security_groups=None, se-curity_groups=None, publicly_accessible=False, multi_az=False,db_parameter_group=None, option_group=None)

Create a Database Instance.

Parameters

• subnets (list) – A list of at least two Subnet objects that are located in different Avail-ablity Zones (AZs) of the same Region. These Subnet objects will be used to create a DBSubnet Group.

– See also: sky.database.create_db_subnet_group()

• name (str) – An optional name for the RDS Instance. A name will be generated from thecurrent project name, if one is not specified.

• engine (string) – The desired database engine. This is set to postgresql, by default.

– Supported database engines: postgresql, mysql, and oracle.

• storage (int) – The amount of storage (in gigabytes) to be initially allocated for thedatabase instance.

• application_instances (list) – An optional list of EC2 Instance objects that theDB Instance will be permitted to receive traffic from.

• application_security_groups (list) – An optional list of SecurityGroup ob-jects that the DB Instance will be permitted to receive traffic from.

• security_groups (boto.ec2.securitygroup.SecurityGroup) – An op-tional list of SecurityGroup objects that the DB Instance will join.

1.2. sky.database – Amazon RDS Services 9

Page 14: Sky Documentation - media.readthedocs.org file• security_groups (list) – An optional list of SecurityGroup objects that the EC2 Instance will join. – See also: sky.compute.create_security_group()

Sky Documentation, Release 0.1

• publicly_accessible (bool) – Whether to alllow devices outside of the VPC hostingthe DB Instance to connect to the DB Instance. If True, a Public IP address is allocatedfor the DB Instance. By default, this is set to False and a DB Instance is not publiclyaccessible.

• multi_az (bool) – Whether to provision and maintain a synchronous standby replica DBInstance in a different Availability Zone (AZ). By default, this is set to False and a DBInstance will be deployed to a single AZ.

• db_parameter_group (boto.jsonresponse.Element) – An optional DB Pa-rameter Group that specifies features and configuration applicable to many database engines.

• option_group (boto.jsonresponse.Element) – An optional Option Group thatspecifies features and configuration specific to the chosen database engine.

Return type dict

Returns A dictionary containing the elements of the AWS API CreateDBInstanceResponseresponse.

sky.database.create_db_parameter_group(name=None, engine=’postgresql’)Create a DB Parameter Group.

Parameters

• name (str) – An optional name for the DB Parameter Group. A name will be generatedfrom the current project name, if one is not specified.

• engine (string) – The database engine that is configured by the DB Parameter Group. Thisis set to postgresql, by default.

– Supported database engines: postgresql, mysql, and oracle.

Return type dict

Returns A dictionary containing the elements of the AWS APICreateDBParameterGroupResponse response.

sky.database.create_db_subnet_group(subnets, name=None)Create a DB Subnet Group.

Parameters

• subnets (list) – A list of at least two Subnet objects that are located in different Avail-ablity Zones (AZs) of the same Region.

For Multi-AZ deployments, these define where the database will be created and where thedatabase will be replicated . For Single-AZ deployments, these are defined so that it ispossible to convert the database to Multi-AZ at a later point.

– See also: sky.networking.create_subnets().

• name (str) – An optional name for the DB Subnet Group. A name will be generated fromthe current project name, if one is not specified.

Return type dict

Returns A dictionary containing the elements of the AWS APICreateDBSubnetGroupResponse response.

sky.database.create_option_group(name=None, engine=’postgresql’)Create an Option Group.

An option group can specify features, called options, that are available for a particular Amazon RDS DB in-stance. Options can have settings that specify how the option works.

10 Chapter 1. sky – Main package

Page 15: Sky Documentation - media.readthedocs.org file• security_groups (list) – An optional list of SecurityGroup objects that the EC2 Instance will join. – See also: sky.compute.create_security_group()

Sky Documentation, Release 0.1

Parameters

• name (str) – An optional name for the Option Group. A name will be generated from thecurrent project name, if one is not specified.

• engine (string) – The database engine that is configured by the Option Group. This is setto postgresql, by default.

– Supported database engines: postgresql, mysql, and oracle.

Return type dict

Returns A dictionary containing the elements of the AWS APICreateOptionGroupResponse response.

sky.database.delete_database(name)Delete a Database Instance.

Parameters name (str) – The name of the Database Instance to delete.

Return type bool

Returns True if the Database Instance was successfully deleted. Otherwise, False.

1.3 sky.networking – Amazon VPC Services

sky.networking.attach_internet_gateway(vpc)Attach a Private Network (VPC) to the Internet.

Parameters vpc (boto.vpc.vpc.VPC) – The VPC that will be connected to the Internet.

• See also: sky.networking.create_network().

Return type bool

Returns True if the VPC was successfully connected to the Internet. Otherwise, False.

sky.networking.connect_vpc()Connect to the Amazon Virtual Private Cloud (Amazon VPC) service.

Return type boto.vpc.VPCConnection

Returns A VPCConnection object.

sky.networking.create_network(name=None, cidr_block=None, network_class=None, inter-net_connected=False)

Create a Private Network (VPC).

Parameters

• name (str) – An optional name for the Virtual Private Cloud (VPC). A name will be gener-ated from the current project name, if one is not specified.

• cidr_block (string) – A CIDR block defining a Class A, Class B, or Class C Private Net-work. Note that only one of the cidr_block and network_class parameters shouldreceive arguments. If both are specified, cidr_block takes precedence.

• network_class (string) – A string, indicating a Class A, Class B, or Class C Private Net-work. Note that only one of the cidr_block and network_class parameters shouldreceive arguments. If both are specified, cidr_block takes precedence.

– Valid values: A defines a 10.0.0.0/16 CIDR block, B defines a 172.16.0.0/16CIDR block, and C defines a 192.168.0.0/16 CIDR block.

1.3. sky.networking – Amazon VPC Services 11

Page 16: Sky Documentation - media.readthedocs.org file• security_groups (list) – An optional list of SecurityGroup objects that the EC2 Instance will join. – See also: sky.compute.create_security_group()

Sky Documentation, Release 0.1

• internet_connected (bool) – Specifies whether the Virtual Private Cloud (VPC) In-stance will be connected to the Internet via an attached Internet Gateway. If set to True, theVPC will be connected to the Internet. By default, a VPC is not connected to the Internet.

– See also: sky.networking.attach_internet_gateway().

Return type boto.vpc.vpc.VPC

Returns The created VPC network.

sky.networking.create_route_table(vpc, name=None, internet_access=False)Create a Route Table.

Parameters

• vpc (boto.vpc.vpc.VPC) – The VPC that the Route Table will belong to.

– See also: sky.networking.create_network().

• name (str) – An optional name for the Route Table. A name will be generated from thecurrent project name, if one is not specified.

• internet_access (bool) – Specifies whether the Route Table will contain a route to theInternet (0.0.0.0/0, in CIDR notation).

Return type boto.vpc.routetable.RouteTable

Returns The created RouteTable object.

sky.networking.create_subnet(vpc, zone, cidr_block, subnet_name=None, route_table=None)Create a Subnet.

Parameters

• vpc (boto.vpc.vpc.VPC) – The VPC that the Subnet will belong to.

– See also: sky.networking.create_network().

• zone (boto.ec2.zone.Zone) – A Zone object indicating which Availability Zone(AZ) to create the Subnet in.

– See also: boto.ec2.connection.get_all_zones().

• cidr_block (string) – A CIDR block defining a Class A, Class B, or Class C PrivateNetwork.

• name (str) – An optional name for the Subnet. A name will be generated from the currentproject name, if one is not specified.

• route_table (boto.vpc.routetable.RouteTable) – An optionalRouteTable that will be associated to the Subnet.

Return type boto.vpc.subnet.Subnet

Returns The created Subnet.

sky.networking.create_subnets(vpc, zones=’all’, count=1, byte_aligned=True, balanced=False,public=False)

Create Subnets.

Parameters

• vpc (boto.vpc.vpc.VPC) – The VPC that the Subnets will belong to.

– See also: sky.networking.create_network().

• zones (list) – A list of strings indicating which Availability Zone(s) (AZs) to create Subnetsin. By default, this is set to all AZs in the Region.

12 Chapter 1. sky – Main package

Page 17: Sky Documentation - media.readthedocs.org file• security_groups (list) – An optional list of SecurityGroup objects that the EC2 Instance will join. – See also: sky.compute.create_security_group()

Sky Documentation, Release 0.1

• count (int) – The number of Subnets to create in each Availability Zone (AZ). By default,this is set to 1.

• byte_aligned (bool) – Specifies whether or not to align the Subnet network addressto the nearest byte. This results in cleaner Private IP addresses, where Subnets will bedesignated IPs, e.g., 10.0.1.0, 10.0.2.0, ... 10.0.n.0. By default, Subnets will be byte-aligned.

• balanced (bool) – Specifies whether or not to balance a Subnet capacity with the net-work’s expandability. If, for example, byte_aligned is False and balanced is alsoFalse, a single list of Subnet objects will be created, each with the maximum possiblenetwork capacity. If balanced is True, in this case, a the maximum threshold of Subnetsand their network capacity is equal. By default, this is set to False and Subnets will becreated to maximize their network capacity.

Return type list

Returns A list of Subnet objects.

sky.networking.delete_internet_gateways(internet_gateways)Delete an Internet Gateway.

Parameters vpc (list) – A list of InternetGateway objects that will be deleted.

• See also: sky.networking.attach_internet_gateway().

Return type bool

Returns True if the InternetGateway objects were successfully deleted. Otherwise, False.

sky.networking.delete_network(vpc)Delete a network.

Parameters vpc (boto.vpc.vpc.VPC) – The VPC that will be deleted.

• See also: sky.networking.create_network().

Return type bool

Returns True if the VPC was successfully deleted. Otherwise, False.

sky.networking.delete_route_tables(route_tables)Delete Route Tables.

Parameters vpc (list) – A list of RouteTable objects that will be deleted.

• See also: sky.networking.create_route_table().

Return type bool

Returns True if the RouteTable objects were successfully deleted. Otherwise, False.

sky.networking.delete_subnets(subnets)Delete Subnets.

Parameters vpc (list) – A list of Subnet objects that will be deleted.

• See also: sky.networking.create_subnets().

Return type bool

Returns True if the Subnet objects were successfully deleted. Otherwise, False.

sky.networking.get_cidr_block_components(cidr_block)Break CIDR block into IP and Netmask components.

Return type tuple

1.3. sky.networking – Amazon VPC Services 13

Page 18: Sky Documentation - media.readthedocs.org file• security_groups (list) – An optional list of SecurityGroup objects that the EC2 Instance will join. – See also: sky.compute.create_security_group()

Sky Documentation, Release 0.1

Returns A tuple in the format: (network_ip, netmask).

sky.networking.get_default_vpc()Get the Default VPC in the Region, if one exists. This is a special VPC that behaves like EC2-Classic.

Return type boto.vpc.vpc.VPC

Returns The Default VPC.

sky.networking.get_network_capacity(netmask)Get a network capacity, i.e., the maximum number of hosts on a given network.

Parameters netmask (string) – The netmask of a given network, ranging 0-32 inclusively.

Return type int

Returns The network’s capacity.

sky.networking.validate_cidr_block(cidr_block)Validate that a CIDR block is in the correct format and applicable to VPC networking.

Parameters cidr_block (string) – A CIDR block defining a Class A, Class B, or Class C PrivateNetwork.

Return type bool

Returns True, if cidr block formatted correctly for use with VPC networking. Otherwise,False.

1.4 sky.security – Amazon IAM Services

sky.security.connect_iam()Connect to the Amazon Identity and Access Management (Amazon IAM) service.

Return type boto.s3.connection.S3Connection

Returns An S3Connection object.

sky.security.create_role(inline_policies)Creates a Role, along with an associated Role Policy and Instance Profile.

Parameters inline_policies (list) – A list of JSON-formatted IAM Policies (strings), defin-ing actions that are permitted as a member of this role.

Return type boto.jsonresponse.Element

Returns The created Role.

sky.security.delete_role(role_name)Deletes the specified Role. Will remove and delete any Role Policies and Instance Profiles associated to theRole.

Parameters role_name (string) – The name of the role to delete.

sky.security.upload_ssl_certificate(public_key, private_key, certificate_chain=None,name=None)

Uploads a SSL Certificate to the Amazon IAM service and provides its Amazon Resource Name (ARN).

Parameters

• public_key (str) – The path to a PEM-encoded public key certificate file. Thisfile will have one -----BEGIN CERTIFICATE----- heading and one -----ENDCERTIFICATE----- heading.

14 Chapter 1. sky – Main package

Page 19: Sky Documentation - media.readthedocs.org file• security_groups (list) – An optional list of SecurityGroup objects that the EC2 Instance will join. – See also: sky.compute.create_security_group()

Sky Documentation, Release 0.1

– Warning: Do not put this file into version control.

• private_key (str) – The path to a PEM-encoded private key file. This file willhave one -----BEGIN RSA PRIVATE KEY----- heading and one -----END RSAPRIVATE KEY----- heading.

– Warning: Do not put this file into version control.

• certificate_chain (str) – An optional path to a PEM-encoded certificate chain file.This file will likely have several -----BEGIN CERTIFICATE----- and -----ENDCERTIFICATE----- headings.

– Warning: Do not put this file into version control.

• key_name (str) – An optional name for the SSL Certificate. A name will be generatedfrom the current project name, if one is not specified.

Return type str

Returns The Amazon Resource Name (ARN) of the uploaded SSL Certificate.

1.5 sky.storage – Amazon S3 Services

sky.storage.add_object(bucket, obj)Upload a local file to an S3 bucket.

Parameters

• bucket (boto.s3.bucket.Bucket) – The Bucket that the file will be uploaded to.

• obj (string) – The local filename.

sky.storage.connect_s3()Connect to the Amazon Simple Storage Service (Amazon S3).

Return type boto.iam.connection.IAMConnection

Returns An IAMConnection object.

sky.storage.create_bucket()Create an S3 bucket for static file storage.

Return type boto.s3.bucket.Bucket

Returns An S3 Bucket.

sky.storage.get_bucket_policy(bucket)Get an IAM Policy that will permit EC2 Instances to copy files from an S3 Bucket.

Parameters

• bucket (boto.s3.bucket.Bucket) – The Bucket that the IAM Policy will be gen-erated for.

• obj (string) – The JSON-formatted IAM Policy.

1.6 sky.utils – Sky Utility Functions

sky.utils.configure_logger(args)Configure the application/package logger. (This is used internally.)

1.5. sky.storage – Amazon S3 Services 15

Page 20: Sky Documentation - media.readthedocs.org file• security_groups (list) – An optional list of SecurityGroup objects that the EC2 Instance will join. – See also: sky.compute.create_security_group()

Sky Documentation, Release 0.1

sky.utils.get_closest_region(service=’ec2’, repetitions=1)Get the closest region for a particular service based on its average response time.

Parameters

• service (str) – The service to attempt a connection to. By default, this is ec2.

• repetitions (int) – The number of measurements to take before calculating an average.

sky.utils.get_script(region, s3bucket, s3object, filename=’user-data.sh’)Gets a User-Data script that instructs an EC2 instance to copy an object from an S3 Bucket and run a commandafterwards.

Parameters

• region (str) – The region that the Bucket is located in.

– Note: If the S3 Bucket is located in the boto.s3.connection.Location.DEFAULT(US Standard) S3 region, specify us-east-1.

• bucket (boto.s3.bucket.Bucket) – The Bucket to copy the object from.

• s3object (str) – The name of the object to download.

• filename (str) – The path to a template user-data script.

sky.utils.make_tarfile(output_filename, source_dir)Create a tarfile that extracts cleanly to a specified directory.

sky.utils.parse_arguments()Parse command line arguments. (This is used internally.)

16 Chapter 1. sky – Main package

Page 21: Sky Documentation - media.readthedocs.org file• security_groups (list) – An optional list of SecurityGroup objects that the EC2 Instance will join. – See also: sky.compute.create_security_group()

CHAPTER 2

Indices and tables

• genindex

• modindex

• search

17

Page 22: Sky Documentation - media.readthedocs.org file• security_groups (list) – An optional list of SecurityGroup objects that the EC2 Instance will join. – See also: sky.compute.create_security_group()

Sky Documentation, Release 0.1

18 Chapter 2. Indices and tables

Page 23: Sky Documentation - media.readthedocs.org file• security_groups (list) – An optional list of SecurityGroup objects that the EC2 Instance will join. – See also: sky.compute.create_security_group()

Python Module Index

ssky, 3sky.compute, 3sky.database, 9sky.networking, 11sky.security, 14sky.storage, 15sky.utils, 15

19

Page 24: Sky Documentation - media.readthedocs.org file• security_groups (list) – An optional list of SecurityGroup objects that the EC2 Instance will join. – See also: sky.compute.create_security_group()

Sky Documentation, Release 0.1

20 Python Module Index

Page 25: Sky Documentation - media.readthedocs.org file• security_groups (list) – An optional list of SecurityGroup objects that the EC2 Instance will join. – See also: sky.compute.create_security_group()

Index

Aadd_object() (in module sky.storage), 15allocate_address() (in module sky.compute), 3attach_internet_gateway() (in module sky.networking), 11

Cconfigure_logger() (in module sky.utils), 15connect_ec2() (in module sky.compute), 3connect_iam() (in module sky.security), 14connect_rds() (in module sky.database), 9connect_s3() (in module sky.storage), 15connect_vpc() (in module sky.networking), 11create_bucket() (in module sky.storage), 15create_database() (in module sky.database), 9create_db_parameter_group() (in module sky.database),

10create_db_subnet_group() (in module sky.database), 10create_instance() (in module sky.compute), 3create_instances() (in module sky.compute), 4create_load_balancer() (in module sky.compute), 5create_nat_instance() (in module sky.compute), 5create_nat_instances() (in module sky.compute), 5create_network() (in module sky.networking), 11create_option_group() (in module sky.database), 10create_role() (in module sky.security), 14create_route_table() (in module sky.networking), 12create_security_group() (in module sky.compute), 6create_subnet() (in module sky.networking), 12create_subnets() (in module sky.networking), 12

Ddelete_database() (in module sky.database), 11delete_instances() (in module sky.compute), 7delete_internet_gateways() (in module sky.networking),

13delete_load_balancer() (in module sky.compute), 7delete_network() (in module sky.networking), 13delete_role() (in module sky.security), 14delete_route_tables() (in module sky.networking), 13delete_security_group() (in module sky.compute), 7

delete_subnets() (in module sky.networking), 13deregister_instances() (in module sky.compute), 7

Gget_bucket_policy() (in module sky.storage), 15get_cidr_block_components() (in module

sky.networking), 13get_closest_region() (in module sky.utils), 15get_default_vpc() (in module sky.networking), 14get_instances() (in module sky.compute), 7get_nat_image() (in module sky.compute), 8get_network_capacity() (in module sky.networking), 14get_script() (in module sky.utils), 16

Mmake_tarfile() (in module sky.utils), 16

Pparse_arguments() (in module sky.utils), 16

Rregister_instances() (in module sky.compute), 8rotate_instances() (in module sky.compute), 8

Ssky (module), 3sky.compute (module), 3sky.database (module), 9sky.networking (module), 11sky.security (module), 14sky.storage (module), 15sky.utils (module), 15

Tterminate_instances() (in module sky.compute), 9

Uupload_ssl_certificate() (in module sky.security), 14

Vvalidate_cidr_block() (in module sky.networking), 14

21