Deploy only a subset of source using CodeDeploy S3 provider

0

Hi,

I have a CodeCommit repository and CodePipeline pipeline which I'm using for a web application. The application includes some javascript I'd like to deploy to S3. As far as I can tell, the S3 action provider of CodeDeploy copies the whole source artefact to the target bucket. Is there any way of being selective about the parts of the repo to publish? For example it'd be great if I could only deploy the "publicsite" subdirectory to S3. I guess I could script this separately somewhere in the build, but I'd like to keep things as simple as possible.

Thanks

已提问 2 年前532 查看次数
1 回答
1
已接受的回答

The most granular thing CodeDeploy can deploy is a build artifact. Think of an artifact as "a group of files that should be deployed to a single destination". So if you want to deploy only your "publicsite" files to S3 you'll need to define a separate build artifact that includes only those files.

I use this approach in my own projects when I want to deploy my web app to one server and my generated documentation to a different server, for example. Here's an example of how my documentation artifact is defined in the buildspec.yml:

artifacts:
    files:
        - '**/*'
    base-directory: docs/user-guide
    name: DocBuildOutput
profile pictureAWS
Kris
已回答 2 年前
profile picture
专家
已审核 1 个月前
  • Thank you. Makes sense. I assume that means a build stage is required prior to define the more granular artifact?

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则