'How to store CodeBuild output artifact in S3 bucket folder with the folder name as build-date

I have a codebuild project which creates a binary distribution wheel stored in the dist directory.

My Codebuild project buildspec [relevant lines]

artifacts:
  files:
    - "*.whl"
  name: $(date +%Y-%m-%d)
  #discard-paths: yes
  base-directory: 'dist'

Artifacts

  • Type: S3
  • Bucketname:
  • Name:
  • Path: path/to/folder/in/s3/bucket
  • Artifact packaging: None

The codebuild project runs successfully but the output artifact is not in the directory with the date.



Solution 1:[1]

Try something like this:

# Artifacts
  artifacts:
    locaton            = aws_s3_bucket.myapp-project.bucket
    type               = "S3"        
    name               = "YourFilename.json"
    path               = "assets/translations/"
    packaging          = "NONE"

In Summary, your missing the S3 bucket location if you are not using a codepipeline. A similar article can be found here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1