首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >发生错误: IamRoleLambdaExecution -角色的最大策略大小超过10240字节

发生错误: IamRoleLambdaExecution -角色的最大策略大小超过10240字节
EN

Stack Overflow用户
提问于 2021-09-16 12:49:53
回答 3查看 2.2K关注 0票数 0

在serverless.yml中使用无服务器插件拆分堆栈并获得此错误

发生错误: IamRoleLambdaExecution -最大策略大小超过角色Vkonnect-dev-ap-1-lambdaRole(服务: AmazonIdentityManagement;状态代码: 409;错误代码: LimitExceeded;请求ID: 51920d55-4b81-4b6c-99f1-d9f0ba087cc2;代理: null)。

当我使用serverless-plugin-custom-roles时,我会得到这个错误

dependency . CloudFormation模板无效:资源之间的循环依赖关系: GenerateOtpDocLambdaPermissionApiGateway,CloudFormation.

serverless.yml

代码语言:javascript
复制
service: Vkonnect #Name of your App

provider:
  name: aws
  runtime: nodejs14.x # Node JS version
  memorySize: 128
  timeout: 10
  stage: dev
  region: ap-south-1 # AWS region
  deploymentBucket:
    name: vkonnectlayers
  # iamRoleStatements:
  #   - Effect: "Allow"
  #     Action:
  #       - "s3:*"
  #     Resource:
  # NOTE you can't refer to the LogicalID of S3Bucket, otherwise
  # there will be a circular reference in CloudFormation
  iamRoleStatements:
    - Effect: "Allow"
      Action:
        - "cloudformation:*"
        - "codecommit:*"
        - "apigateway:*"
        - "execute-api:Invoke"
        - "execute-api:ManageConnections"
        - "cloudformation:DescribeStacks"
        - "cloudformation:ListStackResources"
        - "cloudwatch:ListMetrics"
        - "cloudwatch:GetMetricData"
        - "ec2:DescribeSecurityGroups"
        - "ec2:DescribeSubnets"
        - "ec2:DescribeVpcs"
        - "kms:ListAliases"
        - "iam:GetPolicy"
        - "iam:GetPolicyVersion"
        - "iam:GetRole"
        - "iam:GetRolePolicy"
        - "iam:ListAttachedRolePolicies"
        - "iam:ListRolePolicies"
        - "iam:ListRoles"
        - "lambda:*"
        - "logs:DescribeLogGroups"
        - "states:DescribeStateMachine"
        - "states:ListStateMachines"
        - "tag:GetResources"
        - "xray:GetTraceSummaries"
        - "xray:BatchGetTraces"
      Resource:
        - "*"
        - "arn:aws:apigateway:*::/*"
        - "arn:aws:events:*:*:rule/codecommit*"
        - "arn:aws:logs:*:*:log-group:/aws/lambda/*"

plugins:
  - serverless-offline
  - serverless-layers
  - serverless-plugin-split-stacks
  - serverless-plugin-custom-roles
  # - serverless-nested-stack
package:
  individually: true
  exclude:
    - ./**

custom:
  splitStacks:
    perFunction: false
    perType: false
    perGroupFunction: true
    nestedStackCount: 5
  serverless-layers: # All Layers
    - moment:
        name: moment
        excludeDevDependencies: false
        individually: true
        dependenciesPath: ./layers/moment-layer/package.json
        package:
          patterns:
            - /**
            - "!node_modules/**"
EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2021-09-17 06:21:50

第一创

IAM角色

在aws帐户中,您可以完全访问您想要的服务,然后执行以下操作

serverless.yaml

代码语言:javascript
复制
provider:
  name: aws
  runtime: nodejs14.x
  memorySize: 128
  timeout: 5
  stage: prod
  region: us-east-1 # AWS region
  versionFunctions: false
  deploymentBucket:
    name: XXXXXX
  iam:
    role: arn:aws:iam::XXXXXX:role/full   //your role arn
plugins:
  - serverless-offline
  - serverless-layers
  - serverless-plugin-split-stacks
package:
  individually: true
  exclude:
    - ./**
票数 0
EN

Stack Overflow用户

发布于 2021-09-16 13:03:58

有关策略大小限制错误:

AWS对策略大小有限制。查看本文以获得参考:https://aws.amazon.com/premiumsupport/knowledge-center/iam-increase-policy-size/

对于循环依赖错误:

查看这个AWS博客:https://aws.amazon.com/blogs/infrastructure-and-automation/handling-circular-dependency-errors-in-aws-cloudformation/

票数 0
EN

Stack Overflow用户

发布于 2021-09-16 15:03:24

AWS是对少有的资源设置限制,如IAM、S3等。资源不应超过设定的限制。您可以向AWS支持提交请求以增加限制。

在此之前,您可以使用AWS中的service quota来了解AWS资源的限制。在此基础上,您可以拨打电话向AWS提交请求,或者按照上面的文档来缩小大小。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69208763

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档