aws Module

The aws submodule contains classes representing AWS resources

This module contains classes representing AWS resources:
  • DockerRepo : AWS ECR repository

  • BatchJob : AWS Batch job

For each class, you may specify an identifier for an existing AWS resource or specify parameters to create a new resource on AWS. Higher level resources (e.g. ComputeEnvironment) take subordinate resources (e.g. IamRole) as input.

Classes

cloudknot.aws.DockerRepo(name[, ...])

Class for creating and managing remote docker repositories.

cloudknot.aws.BatchJob([job_id, name, ...])

Class for defining AWS Batch Job.

Functions

cloudknot.aws.get_region()

Get the default AWS region

cloudknot.aws.set_region([region])

Set the AWS region that cloudknot will use

cloudknot.aws.get_profile([fallback])

Get the AWS profile to use

cloudknot.aws.set_profile(profile_name)

Set the AWS profile that cloudknot will use

cloudknot.aws.list_profiles()

Return a list of available AWS profile names

cloudknot.aws.refresh_clients([max_pool])

Refresh the boto3 clients dictionary

cloudknot.aws.get_s3_params()

Get the cloudknot S3 bucket and corresponding access policy

cloudknot.aws.set_s3_params(bucket[, ...])

Set the cloudknot S3 bucket

Clients

aws.clients = {'batch': <botocore.client.Batch object>, 'cloudformation': <botocore.client.CloudFormation object>, 'ec2': <botocore.client.EC2 object>, 'ecr': <botocore.client.ECR object>, 'ecs': <botocore.client.ECS object>, 'iam': <botocore.client.IAM object>, 's3': <botocore.client.S3 object>}

Module-level dictionary of boto3 clients for IAM, EC2, Batch, ECR, and ECS.

Storing the boto3 clients in a module-level dictionary allows us to change the region and profile and have those changes reflected globally.

Advanced users: if you want to use cloudknot and boto3 at the same time, you should use these clients to ensure that you have the right profile and region.

Exceptions

cloudknot.aws.ResourceDoesNotExistException(...)

Exception indicating that the requested AWS resource does not exists

cloudknot.aws.ResourceClobberedException(...)

Exception indicating that this AWS resource has been clobbered

cloudknot.aws.ResourceExistsException(...)

Exception indicating that the requested AWS resource already exists

cloudknot.aws.CannotDeleteResourceException(...)

Exception indicating that an AWS resource cannot be deleted

cloudknot.aws.CannotCreateResourceException(message)

Exception indicating that an AWS resource cannot be created

cloudknot.aws.RegionException(resource_region)

Exception indicating the current region is not this resource's region