Search code examples
amazon-s3aws-codepipelineaws-codebuildaws-code-deploy

AWS CodeDeploy not extracting files before deploy


I am working with AWS CodePipeline to deploy a static website to an S3 bucket. I have the process set up and running, but my only problem is that the zip file build artifact is not being extracted before uploading to S3.

It gets uploaded the the S3 bucket as the zip file and not extracted like I’m expecting

CodeBuild

version: 0.2
   phases:
      install:
         runtime-versions:
            nodejs: 16
      pre build:
         commands:
            - echo Installing source NPM dep
            - npm install
      build:
         commands:
            - echo Build started on 'date'
            - npm run build
      post_build:
         commands:
            - zip -r test.zip dist
artifacts:
  files:
     - 'test.zip'

CodeDeploy

enter image description here


Solution

  • There's no need to zip your files - CodeBuild does that for you automatically.

    You can probably use this answer from a related question:

    artifacts:
      files:
        - '**/*'
      base-directory: 'dist'