Skip to content

Conversation

@danifitz
Copy link

@danifitz danifitz commented Nov 8, 2021

Make the -p flag optional allowing user to supply one or more profiles to be used to gather inventory.

New default behaviour, if -p is omitted, we'll just use the default AWS CLI behaviour which is to look for env vars such as AWS_SECRET_ACCESS_KEY.

Examples:

./lw_aws_inventory.sh - gather inventory for the account defined on the machines env vars
./lw_aws_inventory.sh -j - same as above but with JSON output.
./lw_aws_inventory.sh -p prod - gather inventory for the account with profile prod in ~/.aws/credentials
aws-vault exec profile_name -- ./lw_aws_inventory.sh - gather inventory using credentials from aws vault

Daniel Fitzgerald added 2 commits November 8, 2021 15:50
…lag optional rather than mandatory. User can pass a single profile or comma seperated list of AWS profiles using -p flag. If -p isnt specified, it will attempt to use any environment which is configured.
while getopts ":p:j" opt; do
case ${opt} in
p )
USE_PROFILE="true"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding a description of the script options to the PR.
Could we add something to the echo to describe the fields?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants