serverless-offline-assume-role

1.0.0 • Public • Published

serverless-offline-assume-role

CircleCI (all branches) npm GitHub

This Serverless plugin allows you to develop offline by specifying which role from ~/.aws/config that you would like to run under when your organization uses AWS Multiple Account Billing Strategy. This plugin is made to work with the serverless-offline plugin.

NOTE:

This plugin is not to be confused with setting the AWS_PROFILE environment variable. That environment variable reads from ~/.aws/credentials and is used when you have multiple access and secret access keys for multiple accounts.

Documentation

Installation

First install the plugins.

npm install serverless-offline serverless-offline-assume-role --save-dev

Then inside of your project's serverless.yml file add the following to the plugins section. Note it is important that serverless-offline-ssm is loaded before serverless-offline. This is important to ensure that we are setting the variables properly for serverless-offline before it needs them.

plugins:
    - serverless-offline-assume-role
    - serverless-offline

Then, given an ~/.aws/config file that looks similar to the following:

[default]
region=us-west-2
output=json
 
[profile dev]
role_arn = arn:aws:iam::123456789012:role/dev
source_profile = default
 
[profile qa]
role_arn = arn:aws:iam::123456789012:role/qa
source_profile = default
 
[profile prod]
role_arn = arn:aws:iam::123456789012:role/prod
source_profile = default

Lastly, add your preferred under the serverless-offline object under custom in serverless.yml

custom:
  serverless-offline:
    role: "dev"

Contributing

Pull requests are always welcome. Please see the contributing guidelines.

License

MIT

Package Sidebar

Install

npm i serverless-offline-assume-role

Weekly Downloads

60

Version

1.0.0

License

MIT

Unpacked Size

7.51 kB

Total Files

5

Last publish

Collaborators

  • janders223