Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services 如何将S3 bucket中的文件添加到AWS代码管道中的输出工件?(NodeJS)_Amazon Web Services_Amazon S3_Aws Codepipeline_Aws Codebuild_Buildspec - Fatal编程技术网

Amazon web services 如何将S3 bucket中的文件添加到AWS代码管道中的输出工件?(NodeJS)

Amazon web services 如何将S3 bucket中的文件添加到AWS代码管道中的输出工件?(NodeJS),amazon-web-services,amazon-s3,aws-codepipeline,aws-codebuild,buildspec,Amazon Web Services,Amazon S3,Aws Codepipeline,Aws Codebuild,Buildspec,我正在使用一个AWS代码管道,它从我的git存储库获取源代码,使用CodeBuildbuildSpec来构建输出工件并将其保存到S3 bucket,最终部署到Elastic BeanStalk(NodeJS环境) 一切正常,但我要求管道从我的AWS S3存储桶中复制一个特定文件,并将其添加到输出工件中,然后再将其部署到EB 可以使用buildSpec完成吗 artifacts: files: - '**/*' # - How to add a file from S3 to

我正在使用一个AWS代码管道,它从我的git存储库获取源代码,使用
CodeBuild
buildSpec来构建输出工件并将其保存到S3 bucket,最终部署到
Elastic BeanStalk
(NodeJS环境)

一切正常,但我要求管道从我的
AWS S3
存储桶中复制一个特定文件,并将其添加到
输出工件中,然后再将其部署到
EB

可以使用buildSpec完成吗

artifacts:
  files:
    - '**/*'
    # - How to add a file from S3 to the artifacts?

我的建议是作为
构建
后期构建
的一部分,将所需文件从s3复制到构建目录中

build:
  commands:
    - echo "Build commands"
    - aws s3 cp --region=xx-xxxx-x "s3://file/in/s3" "local-file-instance-to-include"

然后,您将从s3复制可用于构建的文件,您可以将其添加到工件输出。

我的建议是作为
构建的一部分,或者
后期构建的一部分,将所需文件从s3复制到构建目录中

build:
  commands:
    - echo "Build commands"
    - aws s3 cp --region=xx-xxxx-x "s3://file/in/s3" "local-file-instance-to-include"

然后,您将获得从s3复制的文件,可用于构建,您可以将其添加到工件输出。

尝试添加上述命令,现在我收到以下错误:
command\u EXECUTION\u错误:执行命令时出错:aws s3 cp。。。。。。原因:退出状态1
问题在于权限。CB角色没有访问S3存储桶的权限。谢谢。工作得很好,但由于我正在加载私钥,我不想让bucket对公众开放,你知道如何在这种方法中应用策略吗?尝试添加上述命令,现在我得到了以下错误:
command\u EXECUTION\u错误:执行命令时出错:aws s3 cp。。。。。。原因:退出状态1
问题在于权限。CB角色没有访问S3存储桶的权限。谢谢。工作得很好,但是因为我正在加载私钥,我不想让公众知道这个桶,你知道如何在这种方法中应用策略吗?