Skip to content

Elastic Beanstalk won't deploy due to mismatched artifact names

0

I have a Code Pipeline set up with Elastic Beanstalk, and I'm expecting it to deploy when I make a code change - I have the repo set up to go to CodeCommit, through CodeBuild, then to EB, but it fails on the deploy action because it can't find the artifact, like so: Pipeline Deploy Failure

When I trace through to try to find out which artifact is being searched for, I see that it's looking for this EGoxXMO object: Missing Artifact

I know that the bucket actually exists because I found the bucket, and a set of artifacts in it (but none of them have the correct name). A new artifact is actually created in this bucket (as far as I can tell by matching timestamps) when I make a code change S3 Bucket

What I did to end up in this spot:

  • Started with the Elastic Beanstalk defaults, with it hooked up to a AWS Code repo
  • Cloned the repo locally
  • Grabbed the default Java Corretto download, unzipped, and moved the files into the cloned environment
  • Added a mostly empty (contains "version 0.2" only) buildspec.yml file (or the codebuild fails)
  • Git commit, Git Push

Not sure if I missed a config step somewhere, but how do I get EB to look at the correct artifact? What's causing EB to look for that one specific artifact?

1 Answer
0

The EGoxXMO value is not an Elastic Beanstalk application artifact name that you need to reproduce. It is the S3 object key for a CodePipeline artifact in that particular pipeline execution. CodePipeline passes artifacts between actions by their logical artifact names.

For a Source -> CodeBuild -> Elastic Beanstalk pipeline, check the action wiring:

  • Source output: for example, SourceArtifact
  • CodeBuild input: SourceArtifact
  • CodeBuild output: for example, BuildArtifact
  • Elastic Beanstalk deploy input: BuildArtifact

The Elastic Beanstalk deploy action accepts exactly one input artifact. It does not search the bucket for an object whose key looks like an application name.

The buildspec shown in the question contains only version: 0.2, so it does not tell CodeBuild which files form the deployment output. If CodeBuild is required, first create a directory containing the completed Elastic Beanstalk source bundle, then export that directory. For example:

version: 0.2

phases:
  build:
    commands:
      - <build the application and prepare eb-bundle>

artifacts:
  base-directory: eb-bundle
  files:
    - '**/*'
    - '.ebextensions/**/*'
  discard-paths: no

Replace the placeholder command with the actual build. For the Java SE platform, the artifact root should contain the runnable JAR and normally a Procfile; if there is more than one JAR in the bundle root, the Procfile is required. Do not put an extra parent directory around the bundle contents.

If the repository is already a valid Elastic Beanstalk source bundle and no compilation is needed, the simpler option is to remove the CodeBuild stage and configure the Elastic Beanstalk action to consume SourceArtifact directly.

Before rerunning, download the current execution's CodeBuild output artifact and inspect its ZIP. The runnable JAR, Procfile, and any .ebextensions files should be at the paths expected by Elastic Beanstalk. If that ZIP is correct, then inspect the pipeline definition rather than renaming files in S3: the deploy action's input artifact name must exactly match the preceding action's output artifact name.

Official references:

answered a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.