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

Project description

Read the Docs Version Codacy

Table of content (Full doc in ReadTheDocs) :

What is 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, and for example you will be able of:

  • Run a ssh-command for all instances in all regions

  • List all instances with exposed critical ports like 22 or 3389

  • Get info about all certificates of your account/s

  • Obtain all the infrastructure after a domain associated with a balancer


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

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

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

Test it

To verify that the configuration has been correctly stored, you can run the following test. This test only checks that your user is registered and enabled on the AWS account set in the client’s configuration.

import awspice

aws = awspice.connect(profile='<YOUR_PROFILE>')
aws.test()

Usage

Example: Get balancer and instances behind a domain.

aws = awspice.connect()

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

Example: List all unused volumes

regions = aws.service.ec2.get_regions()
volumes = awsmanager.service.ec2.get_volumes_by('status', 'available', regions=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.

Source Distribution

awspice-1.4.2.tar.gz (24.8 kB view details)

Uploaded Source

File details

Details for the file awspice-1.4.2.tar.gz.

File metadata

  • Download URL: awspice-1.4.2.tar.gz
  • Upload date:
  • Size: 24.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/2.7

File hashes

Hashes for awspice-1.4.2.tar.gz
Algorithm Hash digest
SHA256 2e5f8326c11bec398a8a343a1cfac8bb5fa74f85d95c348a11915b250cf0a63c
MD5 4349bedfc3d3a8904f14f309206f7f68
BLAKE2b-256 24ccd2574e6edde938cfa75d834556e843f7d19ba1b4a53b799ef6b77d08c30b

See more details on using hashes here.

Supported by

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