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

gefragt vor 2 Jahren531 Aufrufe
1 Antwort
1
Akzeptierte Antwort

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
beantwortet vor 2 Jahren
profile picture
EXPERTE
überprüft vor einem Monat
  • Thank you. Makes sense. I assume that means a build stage is required prior to define the more granular artifact?

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen