New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

serverless-iam-roles-per-function

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serverless-iam-roles-per-function

A Serverless plugin to define IAM Role statements as part of the function definition block

  • 3.0.1-b5e1837
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
75K
decreased by-23.53%
Maintainers
1
Weekly downloads
 
Created

What is serverless-iam-roles-per-function?

The serverless-iam-roles-per-function npm package allows you to define custom IAM roles for each function in your Serverless Framework project. This provides fine-grained access control and enhances security by ensuring that each function only has the permissions it needs.

What are serverless-iam-roles-per-function's main functionalities?

Define IAM Role for a Single Function

This feature allows you to define a custom IAM role for a specific function. In this example, the 'hello' function is granted permissions to put and update items in a DynamoDB table.

{
  "service": "my-service",
  "provider": {
    "name": "aws",
    "runtime": "nodejs14.x"
  },
  "functions": {
    "hello": {
      "handler": "handler.hello",
      "iamRoleStatements": [
        {
          "Effect": "Allow",
          "Action": [
            "dynamodb:PutItem",
            "dynamodb:UpdateItem"
          ],
          "Resource": "arn:aws:dynamodb:us-east-1:123456789012:table/my-table"
        }
      ]
    }
  }
}

Define IAM Role for Multiple Functions

This feature allows you to define custom IAM roles for multiple functions within the same service. In this example, the 'hello' function has permissions for DynamoDB, while the 'goodbye' function has permissions for S3.

{
  "service": "my-service",
  "provider": {
    "name": "aws",
    "runtime": "nodejs14.x"
  },
  "functions": {
    "hello": {
      "handler": "handler.hello",
      "iamRoleStatements": [
        {
          "Effect": "Allow",
          "Action": [
            "dynamodb:PutItem",
            "dynamodb:UpdateItem"
          ],
          "Resource": "arn:aws:dynamodb:us-east-1:123456789012:table/my-table"
        }
      ]
    },
    "goodbye": {
      "handler": "handler.goodbye",
      "iamRoleStatements": [
        {
          "Effect": "Allow",
          "Action": [
            "s3:PutObject",
            "s3:GetObject"
          ],
          "Resource": "arn:aws:s3:::my-bucket/*"
        }
      ]
    }
  }
}

Use Managed Policies

This feature allows you to attach AWS managed policies to the IAM role of a function. In this example, the 'hello' function is granted full access to DynamoDB through the AmazonDynamoDBFullAccess managed policy.

{
  "service": "my-service",
  "provider": {
    "name": "aws",
    "runtime": "nodejs14.x"
  },
  "functions": {
    "hello": {
      "handler": "handler.hello",
      "iamRoleStatements": [
        {
          "Effect": "Allow",
          "Action": [
            "dynamodb:PutItem",
            "dynamodb:UpdateItem"
          ],
          "Resource": "arn:aws:dynamodb:us-east-1:123456789012:table/my-table"
        }
      ],
      "iamManagedPolicies": [
        "arn:aws:iam::aws:policy/AmazonDynamoDBFullAccess"
      ]
    }
  }
}

Other packages similar to serverless-iam-roles-per-function

Keywords

FAQs

Package last updated on 03 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc