A tool to interact with VPCs configured in AWS accounts and roles.
Project description
Offprem
A tool to interact with VPCs configured in AWS accounts and roles.
Installation
Requires Python 3.9+:
python -m pip install offprem
Features
- Save the VPC ID and region for all VPCs an account/role has access to.
- Supports roles, and accounts with Multi-Factor Authentication enabled.
- Automatically create STS tokens and boto3 sessions to interact with VPCs.
Usage
Create a configuration file:
from offprem import AWSPremise
search_tags = ['Tags', 'to', 'search', 'for']
premise = AWSPremise()
premise.assign(profile_name='profile_name')
premise.get_all_vpcs(search_tags=search_tags, empty_tags=True)
Providing a profile_name and vpc_name to AWSPremise().assign
will automatically create STS credentials and populates a boto3 session to use. Leverage this by assigning a VPC to query:
from offprem import AWSPremise
premise = AWSPremise()
premise.assign(profile_name='profile_name', vpc_name='vpc_name')
resource_ec2 = premise.session.resource('ec2')
Local Development and Testing
Development
Development and testing should be done in a virtual environment.
$ git clone https://github.com/Fauxsys/offprem.git
$ cd offprem
$ python -m venv venv --prompt offprem
$ source venv/bin/activate
(offprem) $ python -m pip install -U pip
Install offprem locally.
(parserconfig) $ python -m pip install -e ".[test]"
Testing
You can test any changes locally with pytest.
(offprem) $ python -m pytest --cov=offprem
You can also test offprem as an installed package.
(offprem) $ python -m tox
Building a wheel
(offprem) $ python -m pip install build
(offprem) $ python -m build --wheel
There should now be a wheel in the dist
directory.
(offprem) $ ls -1 dist
offprem-0.0.1b-py3-none-any.whl
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for offprem-0.0.1b0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ab60614b879554ab187035348c3eb59ee4e108b8bc2d5aec034f9e4d7f8d597 |
|
MD5 | 66a52f970a9d883147e831b67c10cd05 |
|
BLAKE2b-256 | 60ff237f57ac9a09cb66adf49dc03d1912b8cd6c3e8d0b623f75666f5b706889 |