Skip to main content

Cloud Auxiliary is a python wrapper and orchestration module for interacting with cloud providers

Project description

# cloudaux

[![Join the chat at https://gitter.im/Netflix-Skunkworks/cloudaux](https://badges.gitter.im/Netflix-Skunkworks/cloudaux.svg)](https://gitter.im/Netflix-Skunkworks/cloudaux?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Cloud Auxiliary is a python wrapper and orchestration module for interacting with cloud providers

## Features

- intelligent connection caching.
- handles pagination for certain client methods.
- rate limit handling, with exponential backoff.
- multi-account sts:assumerole abstraction.
- orchestrates all the calls required to fully describe an item.

## Orchestration Supported Technologies

- IAM Role
- IAM User
- S3

## Install

pip install cloudaux


## Example

# Using wrapper methods:
from cloudaux.aws.sqs import get_queue, get_messages
conn_details = {
'account_number': '111111111111',
'assume_role': 'MyRole',
'session_name': 'MySession',
'region': 'us-east-1'
}
queue = get_queue(queue_name='MyQueue', **conn_details)
messages = get_messages(queue=queue)


# Using the CloudAux class
from cloudaux import CloudAux
CloudAux.go('kms.client.list_aliases', **conn_details)

ca = CloudAux(**conn_details)
ca.call('kms.client.list_aliases')


# directly asking for a boto3 connection:
from cloudaux.aws.sts import boto3_cached_conn
conn = boto3_cached_conn('ec2', **conn_details)


# Over your entire environment:
from cloudaux.decorators import iter_account_region

accounts = ['000000000000', '111111111111']

conn_details = {
'assume_role': 'MyRole',
'session_name': 'MySession',
'conn_type': 'boto3'
}

@iter_account_region('kms', accounts=accounts, regions=['us-east-1'], **conn_details)
def list_keys(conn=None):
return conn.list_keys()['Keys']

## Orchestration Example

### Role

from cloudaux.orchestration.aws.iam.role import get_role

# account_number may be extracted from the ARN of the role passed to get_role
# if not included in conn.
conn = dict(
assume_role='SecurityMonkey', # or whichever role you wish to assume into
session_name='cloudaux',
region='us-east-1'
)

role = get_role(
dict(arn='arn:aws:iam::000000000000:role/myRole', role_name='myRole'),
output='camelized', # optional: {camelized underscored}
**conn)

# cloudaux makes a number of calls to obtain a full description of the role
print(json.dumps(role, indent=4, sort_keys=True))

{
"Arn": ...,
"AssumeRolePolicyDocument": ...,
"CreateDate": ..., # str
"InlinePolicies": ...,
"InstanceProfiles": ...,
"ManagedPolicies": ...,
"Path": ...,
"RoleId": ...,
"RoleName": ...,
"_version": 1 # Orchestration results return a _Version
}

### User

from cloudaux.orchestration.aws.iam.user import get_user

user = get_user(
dict(arn='arn:aws:iam::000000000000:user/myUser', role_name='myUser'),
**conn)

print(json.dumps(user, indent=2, sort_keys=True))


{
"AccessKeys": [
{
"AccessKeyId": ...,
"CreateDate": ...,
"LastUsedDate": ...,
"Region": "us-east-1",
"ServiceName": ...,
"Status": "Active",
"UserName": ...,
}
],
"Arn": ...,
"CreateDate": ...,
"InlinePolicies": ...,
"LoginProfile": null,
"ManagedPolicies": [],
"MfaDevices": {},
"Path": "/",
"SigningCertificates": {},
"UserId": ...,
"UserName": ...,
"_version": 1
}

### S3

from cloudaux.orchestration.aws.s3 import get_bucket

conn = dict(
account_number='000000000000',
assume_role='SecurityMonkey')

bucket = get_bucket('MyS3Bucket', **conn)

print(json.dumps(bucket, indent=2, sort_keys=True))

{
"Arn": "arn:aws:s3:::MyS3Bucket",
"Grants": {
"cloudaux_grantee": [
"FULL_CONTROL"
]
},
"LifecycleRules": [
{
"expiration": {
"days": 365
},
"id": "deleteoldstuff",
"prefix": "/doesntactuallyexist",
"status": "Enabled"
}
],
"Logging": {
"enabled": true,
"grants": [],
"prefix": "logs/",
"target": "MyS3LoggingBucket"
},
"Policy": {
"Statement": [
{
"Action": "s3:GetObject",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Resource": "arn:aws:s3:::MyS3Bucket/*",
"Sid": "AddPerm"
}
],
"Version": "2008-10-17"
},
"Tags": {
"tagkey": "tagvalue"
},
"Versioning": {
"Versioning": "Enabled"
},
"_version": 1
}

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cloudaux-1.0.2.tar.gz (18.3 kB view details)

Uploaded Source

File details

Details for the file cloudaux-1.0.2.tar.gz.

File metadata

  • Download URL: cloudaux-1.0.2.tar.gz
  • Upload date:
  • Size: 18.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for cloudaux-1.0.2.tar.gz
Algorithm Hash digest
SHA256 cb859ae9dd029cfe6a0a584139cad37a85b39e88fd6ce30bdc9f6f6942dee513
MD5 fcf6f7075c792cbe95cdd322225c5266
BLAKE2b-256 660293166e11e656df8f77d1371041e2fe9b529bde9bd041f385cc81e8df3517

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page