在 AWS Amplify 中构建应用程序时出现错误 403

问题描述

我试图在 AWS 中构建一个简单的无服务器 Web 应用程序。因此,我将我的静态文件放在 codecommit 中并尝试通过 AWS Amplify 托管它。AWS 认为我们构建 amplify.yml,但它在构建阶段失败。我知道 amplify.yml 有问题,我不知道如何配置它。

amplify.yml :

version: 1
frontend:
  phases:
    # IMPORTANT - Please verify your build commands
    build:
      commands: []
  artifacts:
    # IMPORTANT - Please verify your build output directory
    baseDirectory: /
    files:
      - '**/*'
  cache:
    paths: []

我看到的错误

2021-01-23T15:01:54.840Z [INFO]: # cloning repository: https://git-codecommit.us-east- 
2.amazonaws.com/v1/repos/wildrydes-site
2021-01-23T15:01:55.176Z [INFO]: cloning into 'wildrydes-site'...
2021-01-23T15:02:02.660Z [INFO]: fatal: unable to access 'https://git-codecommit.us-east- 
2.amazonaws.com/v1/repos/wildrydes-site/': The requested URL returned error: 403

解决方法

由于提供的信息量有限,我能提供的最好的信息是您的 CodeCommit 用户的 IAM 权限中的某个问题。 AWS 组件通常需要具有适当的组、角色和/或策略才能完成操作。

换一种说法:CodeCommit 给出 403 Forbidden 错误,因为尝试进行克隆的任何内容都没有正确的权限。授予它正确的权限。