Skip to main content

aws-devops-challenge

Getting Started

  1. Get the AWS API Key and Secret
  2. Place create a folder ~/.aws/ mkdir -p ~/.aws/
  3. Create credentials file inside ~/.aws/ folder vi ~/.aws/credentials. The contents of the file should look like this:
[default]
aws_access_key_id = YOUR_ACCESS_KEY_ID
aws_secret_access_key = YOUR_SECRET_ACCESS_KEY
  1. (Optional)You can choose to create ~/.aws/config file to select your default region:
touch ~/.aws/config
[default]
region = YOUR_PREFERRED_REGION
  1. (Optional) Note: It is recommended but not required to create a python environment using: python3 -m venv YOUR_PYTHON_ENV_NAME source YOUR_PYTHON_ENV_NAME/bin/activate

  2. Install s3-inspect using the following:

pip install s3-inspect
  1. Running the python package

python -m s3inspect -h

usage: __main__.py [-h] [-u {b,kb,mb,gb}] [-p PREFIX] [-gs] [-gr] [-gc]
                   [--timeperiod TIMEPERIOD] [--granularity GRANULARITY]
                   [--metrics METRICS] [-l]
                   regex

Inspect S3 Bucket

positional arguments:
  regex                 Regex Support for Buckets list)

optional arguments:
  -h, --help            show this help message and exit
  -u {b,kb,mb,gb}, --unit {b,kb,mb,gb}
                        Return files sizes in these units: b (bytes), kb
                        (kilobytes), mb (megabytes), gb (gigabytes)
  -p PREFIX, --prefix PREFIX
                        Add prefix for the keys. Example: images/
  -gs, --groubystoragetype
                        When this is set information is grouped by Storage
                        Type
  -gr, --groubyregion   When this is set information is grouped by Region Type
  -gc, --getcost        When this is set cost report is returned Type
  --timeperiod TIMEPERIOD
                        Example: '{"Start":"2019-01-01","End":"2019-05-20"}'
  --granularity GRANULARITY
                        Example: MONTHLY
  --metrics METRICS     Example: 'BlendedCost UNBLENDED_COST AMORTIZED_COST'
  -l, --list            Displays a list of available S3 Buckets in account

Examples

  • Following is to use only regex for bucket name
$ python s3inspect test*

------------------------------------------------------------------
S3 Bucket Inspection Report:
------------------------------------------------------------------
Bucket Name: tests32424312341234
------------------------------------------------------------------
Bucket Creation Date: 2019-05-21 08:04:15+00:00
Recent File Modification Date (Bucket): 2019-05-21 08:08:38+00:00
Total Files: 3
Total Files Size = 0.003 MB
  • The following is an example to get Cost Summary in Json format time python s3inspect -gc --granularity MONTHLY --metrics 'BlendedCost' --timeperiod '{"Start":"2019-01-01","End":"2019-05-20"}' test*

Metadata

Release files for S3-Inspect 1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for S3-Inspect 1.4
File Size Uploaded Provenance
S3-Inspect-1.4.tar.gz 6.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for S3-Inspect 1.4
File Interpreter ABI Platform
S3_Inspect-1.4-py3-none-any.whl Python 3 none any Details

Total release size: 15.1 kB

Release files / S3-Inspect-1.4.tar.gz

Download URL S3-Inspect-1.4.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
0ddff5700de80c0db64b09f81f522f77ae2062cf61a344bbe38528a01861f552
BLAKE2b-256 checksum
How to use checksums
b12be6b42f23921e9873bc873b852f07f58af954153bbe661cab8cf4ae44d58d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.7.3 requests-toolbelt/0.9.1 tqdm/4.26.0 CPython/3.7.2

Release files / S3_Inspect-1.4-py3-none-any.whl

Download URL S3_Inspect-1.4-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f7068edbe33ff3368b94bdee6ca66c568be2be8f4b78884fb606a4b8fc320ad4
BLAKE2b-256 checksum
How to use checksums
52fa9c836f2023fc88b7a7948b063f7bc6c0ead8ac1f31cb1a92eeb193d4e604
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.7.3 requests-toolbelt/0.9.1 tqdm/4.26.0 CPython/3.7.2

Security for S3-Inspect 1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page