首页 > 解决方案 > AWS Codebuild - UPLOAD_ARTIFACTS 阶段出错:BucketRegionError:不正确的区域,存储桶不在端点的“us-east-2”区域中

问题描述

我正在尝试使用俄亥俄州的 codebuild 项目创建工件并将其上传到北加州的 s3 存储桶。但是,构建的最后阶段失败并出现错误“UPLOAD_ARTIFACTS 阶段中的错误:BucketRegionError:不正确的区域,存储桶不在端点的 'us-east-2' 区域中”。下面我提到了 buildspec 文件。创建 Codebuild 项目以从代码提交中选择 buildspec 文件。请问,如何将俄亥俄地区的 codebuild 项目创建的工件添加到北加州地区的 s3 存储桶中?

version: 0.2
phases:
  install:
    runtime-versions:
      python: 3.7
  pre_build:
    commands:
      - pip install --upgrade pip
      - pip install cfn-lint
  build:
    commands:
      - echo Build started on `date`
      - cd ./folder
      - aws cloudformation package --template-file testing.yml --output-template-file testing-packaged-cf.yml --s3-bucket codepipeline-test-bucket --region us-west-1
      - echo $PWD
  post_build:
    commands:
      - echo Build completed on `date`
      - echo $PWD
artifacts:
  files:
    - testing-packaged-cf.yml
  base-directory: $PWD


标签: amazon-web-servicesamazon-s3amazon-cloudformationaws-codepipelineaws-codebuild

解决方案


将工件一次输出到俄亥俄地区,然后在目标 S3 存储桶(俄亥俄地区)和北加州地区的 S3 存储桶之间进行跨地区复制,如何?


推荐阅读