Skip to content
This repository was archived by the owner on Dec 16, 2019. It is now read-only.

No option to pass different profiles #1

Open
JBarnes94 opened this issue Sep 25, 2019 · 1 comment
Open

No option to pass different profiles #1

JBarnes94 opened this issue Sep 25, 2019 · 1 comment

Comments

@JBarnes94
Copy link

There is no option to pass profiles as defined in .aws/

This addition would make it easier to use in a multi account environment.

Profile name and environment can be passed (with default value to keep existing functionality)

Then a session can be created with the profile information,
and the client from this session.

@JBarnes94
Copy link
Author

JBarnes94 commented Sep 25, 2019

def main():
    parser = ArgumentParser()
    parser.add_argument('name', help="name or ID of the resource to query")
    parser.add_argument('--type', '-t', help=(
        "the type of the resource to query\n"
        "list of supported resource types: "
        "https://docs.aws.amazon.com/config/latest/developerguide/resource-config-reference.html"
    ))
    parser.add_argument('--number', '-n', type=int, default=1, help="number of history items to show")
    parser.add_argument('--before', '-b', help="show changes more recent than the specified date and time")
    parser.add_argument('--after', '-a', help="show changes older than the specified date and time")
    parser.add_argument('--deleted', '-d', action='store_true', help="include deleted resources")
    parser.add_argument('--context', '-c', type=int, default=10, help="number of context lines in the diffs")
    parser.add_argument('--no-color', '-o', action='store_true', help="disable colored output")
    parser.add_argument('--profile', '-p', default="default" ,help="Define the profile to use")
    parser.add_argument('--region', '-r', default="eu-west-1", help="Define the region to be used")
    args = parser.parse_args()

    session = boto3.Session(profile_name=args.profile, region_name=args.region)
    config = session.client('config')

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant