A Serverless plugin that makes creation of per function IAM roles easier. It mimics serverless behavior, but creates separate roles for each function instead of a shared one. If you want to create per function roles without using this plugin, you are responsible for providing the corresponding permissions for your function logs and stream events and need to repeat the same permissions from function to function.
service: my-service plugins: - serverless-plugin-custom-roles provider: name: aws iamRoleStatements: # [Optional] these statements will be applied to all functions - Effect: "Allow" Action: - "xray:PutTraceSegments" - "xray:PutTelemetryRecords" Resource: "*" functions: function1: handler: 'src/function1.js' iamRoleStatements: # [Optional] these statements will be applied to this function only (in addition to statements that are applied to all functions) - Effect: "Allow" Action: - "cloudwatch:GetMetricStatistics" - "cloudwatch:DescribeAlarms" - "cloudwatch:PutMetricData" Resource: "*" function2: handler: 'src/function2.js' events: - stream: # Appropriate permissions will be applied automatically type: dynamodb arn: "<stream-arn>"
The MIT License (MIT)
Copyright (c) 2018-2021 Anton Bazhal
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.