boto3_wrapper module

class boto3_wrapper.EC2_Boto(region_name, dry_run=False)

Bases: object

client_type = 'ec2'
create_description_tags()
static ec2_get_security_groups_ids(security_groups)
static ec2_tags_get_value(tags, key)

Get the value of an ec2-tag, given a tags list and a key.

Parameters
  • tags ([{'Key': 'String', 'Value': 'String'...}]) – EC2 instance list of tags.

  • key (String) – EC2 instance tag key.

Returns

String value of the tag if it’s present, empty string otherwise.

Return type

String

fetch_ec2_instances()
fetch_security_groups()
static get_available_regions_names()
static_client = <botocore.client.EC2 object>
static stringify_ec2_tags(tags)

Stringify ec2 tags list

Parameters

tags ([{'Key': 'String', 'Value': 'String'...}]) – EC2 instance list of tags.

Returns

Stringified tags if tags is not None, empty string otherwise.

Return type

String

static tag_exists(instance, tag_key)
upsert_ec2_tags(instance_id, tags)
static upsert_ec2_tags_static(region_name, tags, instance_id)
class boto3_wrapper.IAM_Boto(dry_run=False)

Bases: object

client_type = 'iam'
get_account_users_arns()

Get all users arns in the account :return: a new list of users arns :rtype: [string…]

get_arn_policies_granting_services_access(_arn, _services_namespaces)

Get all policies that grant access to a list of services. :param _arn: Arn(amazon resource name) can be: User, Group, Role :type _arn: string :param _services_namespaces: AWS services namespaces where access wants to be checked :type _services_namespaces: [string…] :return: a new list of dictionaries :rtype: [{Policies, ServiceNamespace}]

boto3_wrapper.flatten(l)