Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated deploy to take in alternative aws profile #307

Closed
wants to merge 1 commit into from

Conversation

AvidDabbler
Copy link

Addressing issue #283
This is an attempt to add support to allow multiple profiles in deployment. The solution that I put together does not allow for the copying an pasting of credentials nor a local import of json file, but simply picks out an alternative profile in the .aws/credentials file. This is best practice anyway and will help prevent accidental publication of local files that may contain keys. This pull request only addresses the 'deploy' command. If this method is acceptable I could take a look at other areas where it may be used.

AWS Credential Doc -> https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-shared.html

@landonreed
Copy link
Contributor

Hi @AvidDabbler, in our use of mastarm at IBI Group, we have actually adopted the practice of just setting the env variable AWS_PROFILE in order to reference a non-default profile (which I think that docs link also mentions).

So, if you're running a mastarm command in the terminal, that would like:

AWS_PROFILE=my_aws_profile mastarm deploy
# or
AWS_PROFILE=my_aws_profile yarn deploy

We've also adopted the use of the npm package execa for writing bash scripts in javascript. If you are looking to write scripts that invoke mastarm, this might also be useful. The usage looks something like:

const execa = require('execa')
await execa('yarn', ['deploy', '--s3bucket', 'myBucket], { env: { 'my_aws_profile' } })

In light of that, I'm inclined to close this PR. Thoughts, @evansiroky?

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.

3 participants