@symbiotic/aws-tools

1.0.0 • Public • Published

aws-tools

assert-aws-account-id

Asserts that the account you are currently logged in to, is the account id you expect to be logged in to. This command will fail if you are logged in to another account so that it can be used in scripting and prevent future commands (like a deploy) from proceeding if you are logged in to the wrong account.

npm install @symbiotic/aws-tools --save-dev
assert-aws-account-id --account-id=111122223333

Motivation

We log in to multiple accounts for different projects, and even different environments for a single project.

We find that for each repo, 99% of the time we're logged into one aws account (the dev environment for that project).

And so we wanted to reduce the risk that we accidentally make changes to the wrong aws account.

Recommend Use

We recommend that for each repo, you set an environment variable with the repo name that is part of one time setup. eg MY_COOL_CATS_AWS_ACCOUNT_ID=111122223333

where do I put this? anywhere that will always be set when you're using the terminal with the project (eg ~/.bash_profile)

Then in the commands you want to protect, you add this command

assert-aws-account-id --account-id=$MY_COOL_CATS_AWS_ACCOUNT_ID

So if you use package.json, it might look like this

 "deploy": "assert-aws-account-id --account-id=$MY_COOL_CATS_AWS_ACCOUNT_ID && scripts/deploy.js"

Readme

Keywords

none

Package Sidebar

Install

npm i @symbiotic/aws-tools

Weekly Downloads

18

Version

1.0.0

License

ISC

Unpacked Size

7.58 kB

Total Files

5

Last publish

Collaborators

  • charliebuildsalot
  • jeremybull
  • benglass
  • jhoguet