警告-部署后未设置cfnRole并创建了不必要的文件

No cfnRole warned and unnecessary files was created after deploy

Serverless: Safeguards Processing...
Serverless: Safeguards Results:

   Summary --------------------------------------------------

   passed - no-unsafe-wildcard-iam-permissions
   passed - framework-version
   warned - require-cfn-role
   passed - allowed-runtimes
   passed - no-secret-env-vars
   passed - allowed-regions
   passed - allowed-stages

   Details --------------------------------------------------

   1) Warned - no cfnRole set
      details: http://slss.io/sg-require-cfn-role
      Require the cfnRole option,which specifies a particular role for CloudFormation to assume while deploying.
  1. 我去过写详细信息的网站。 详细信息:http://slss.io/sg-require-cfn-role 无论如何,我不知道如何解决。
  2. s_hello.py和s_hello2.py始终在部署后生成。 这是我的serverless.yaml文件
    service: myapp
    app: sample-app
    org: xxx
    provider:
      name: aws
      runtime: python3.7
    stage: dev
    region: us-east-1

    package:
        individually: true
    functions:
      hello:
        handler: src/handler/handler.hello
      hello2:
        handler: src/handler2/handler2.hello2

It's always happen although follow this site 。 我的Lambda函数将创建“ s_xxx.py(其中xxx是handler.py文件。

SKYyang0782 回答:警告-部署后未设置cfnRole并创建了不必要的文件

我解决了此问题,请按照以下步骤在AWS IAM中创建cfn角色:

角色->创建角色-> AWS服务->从列表中选择云形成

下一步:权限

您需要选择部署lambda函数所需的所有策略(S3FullAccess,SQSFullAccess,LambdaFullAccess ...)

其中一个是强制性的 AWSConfigRole ,它允许无服务器框架获得此角色。

设置角色后,您需要复制其arn并在提供者级别 cfnRole 之后创建,如下所示:

provider:
  name: aws
  runtime: python3.7
  stage: ${opt:stage,'dev'}
  profile: ${self:custom.deploy-profile.${opt:stage,'dev'}}
  region: us-west-2
  environment:
    TEMP: "/tmp"
  cfnRole: arn:aws:iam::xxxxxxxxxx:role/cfn-Role

这对我有用,希望对您有所帮助!

本文链接:https://www.f2er.com/3140133.html

大家都在问