Skip to main content

Awspice is a wrapper tool of Boto3 library to list inventory and manage your AWS infrastructure The objective of the wrapper is to abstract the use of AWS, being able to dig through all the data of our account. It belongs to ElevenPaths, Telefonica.

Project description

Version PyPI - Python Version Read the Docs Travis-CI Codacy

Table of content (Full doc in ReadTheDocs) :

What is Awspice?

Is a wrapper of Boto3 library to list inventory and manage your AWS infrastructure The objective of the wrapper is to make easier some common tasks in AWS, being able to dig through different regions and accounts.

Awspice make it easy to:

  • List all your EC2 instances for multiple regions and accounts
  • Get deployed infraestructure behind a Load Balancer.
  • List all instances with exposed critical ports like 22 or 3389
  • Get info about all certificates of your account/s
  • Find exposed S3 buckets

Installation

pip install awspice

Configuration

The client is built and configured using awspice.connect(). This method indicates the type of authentication and region on which you are going to work.

import awspice

# Region: eu-west-1 | Profile: Default
aws = awspice.connect()

# Using profiles
aws = awspice.connect(region='us-west-2', profile='dev_profile')
# Using access keys
aws = awspice.connect('us-west-2', access_key='AKIA***********', secret_key='/HR$4************')

Usage

Example: Get balancer and instances behind a domain.

aws = awspice.connect()

elb = aws.service.elb.get_loadbalancer_by('domain', 'donalddumb.com')
for elb_instance in elb['Instances']:
  instance = aws.service.ec2.get_instance_by('id', elb_instance['InstanceId'])

Example: List all unused volumes

all_regions = aws.service.ec2.get_regions()
volumes = awsmanager.service.ec2.get_volumes_by('status', 'available', regions=all_regions)

Example: Search instance in all accounts and regions by Public IP

profiles = aws.service.ec2.get_profiles()
regions = aws.service.ec2.get_regions()

for profile in profiles:
    aws.service.ec2.change_profile(profile)

    instance = aws.service.ec2.get_instance_by('publicip', '35.158.163.235', regions=regions)

    if instance:
        print 'Instance found: %s (Account: %s, Region: %s)' % (instance['InstanceId'], instance['RegionName'], instance['Authorization']['Value'])
        break

Project details


Download files

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

Files for awspice, version 1.7.2
Filename, size File type Python version Upload date Hashes
Filename, size awspice-1.7.2-py2-none-any.whl (43.5 kB) File type Wheel Python version py2 Upload date Hashes View
Filename, size awspice-1.7.2.tar.gz (28.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page