Giter Club home page Giter Club logo

awspy's Introduction

awspy

A Python repository to access AWS APIs

Prerequisites

References

Installation

Using Python 3.8.6, Boto3 1.16.54 for development. https://boto3.amazonaws.com/v1/documentation/api/latest/guide/resources.html

 pip3 install boto3

AWS Credentials

Setup AWS credentials. Download aws cli from:

https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html

 aws configure 

Alternatively the aws creds file can be setup by hand it has the following format. You can obtain your access_key_id and secret from aws console.

[default]
aws_access_key_id = 
aws_secret_access_key = 

Setup Test Buckets

The following was my procedure for manual testing. I used aws to create test buckets, then s3ls was tested against those buckets.

aws s3 sync `pwd` s3://telleztec-fpl --region us-west-1
aws s3 sync `pwd` s3://telleztec-archive --region us-west-1

Package Creation

The following program was used to create a package:

python3 setup.py sdist bdist_wheel 

Usage

The tool has three commands, space, files and buckets. Space prints all the buckets with aggregate usage in b, kb, mb, or gb, and it displays the last time it was touched. Buckets displays the names of the buckets and the creation date. files, lists all the files in each bucket.

Space Usage:

$ python s3ls.py --unit k space
python s3ls.py --unit k space
telleztec-archive              2021-01-13 20:32:12+00:00 2021-01-14 02:50:16+00:00            21.06
telleztec-fpl                  2021-01-13 20:31:28+00:00 2021-01-13 23:57:37+00:00         47324.54

Buckets:

$ python s3ls.py buckets
telleztec-archive                                        2021-01-13 20:32:12+00:00
telleztec-fpl                                            2021-01-13 20:31:28+00:00

List files:

python s3ls.py files
telleztec-archive                                        2021-01-14 00:00:40+00:00 1957.000000
telleztec-archive                                        2021-01-14 00:00:40+00:00 17541.000000
telleztec-archive                                        2021-01-14 00:00:40+00:00 2067.000000
telleztec-archive                                        2021-01-14 02:50:16+00:00   0.000000
telleztec-fpl                                            2021-01-13 23:55:41+00:00 40665.000000
telleztec-fpl                                            2021-01-13 23:55:41+00:00 92699.000000
...

TODO

  • Top - An option to get the top 10 space users in the buckets
  • Headings on the columns would make the output more intuitive.
  • Unit Tests

awspy's People

Contributors

juanman2 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.