如何通过在 AWS 中创建 IAM 角色少使用服务器编写代码而不是手动执行

问题描述

我是 AWS 和 serverless 的新手,我正在尝试在 serverless 中编写代码来创建 IAM 角色。但是,此代码不起作用。任何想法如何修复它或如何以不同的方式做它?我对新想法持开放态度。我想编写代码来为管理员访问和 aws lambda 执行创建 IAM 角色。 这是我到目前为止所写的..

service: twitterbot
# app and org for use with dashboard.serverless.com
#app: your-app-name
#org: your-org-name

# You can pin your service to only deploy with a specific Serverless version
# Check out our docs for more details
frameworkVersion: "2"

provider:
  name: aws
  runtime: python3.8

  # you can overwrite defaults here
  #  stage: dev
  region: ap-southeast-2

  # you can add statements to the Lambda function's IAM Role here
  iamRoleStatements:
    #- Effect: "Allow"
     # Action:
       # - "s3:*"
      #Resource:
      #resources:
  Resources:
    testadminRole:
      Type: AWS::IAM::AdminRole
      Properties:
        RoleName: testadminRole
        Path: /
        AssumeRolePolicyDocument: 
          Version: ‘2012-10-17’
          Statement: 
            - Effect: Allow
              Principal:
                Service:
                  - lambda.amazonaws.com
                  - apigateway.amazonaws.com
              Action: 
                - sts:AssumeRole
        ManagedPolicyArns:
        - "arn:aws:iam::aws:policy/AdministratorAccess"

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)