code3 icon indicating copy to clipboard operation
code3 copied to clipboard

CloudFormation Template in Chapter 16 Missing Application Code Setup Instructions

Open arahas opened this issue 1 year ago • 1 comments

Bug Description

The CloudFormation template in chapter16/template.yaml assumes the existence of Node.js applications in /home/ec2-user/worker/ and /home/ec2-user/server/ directories, but these directories and the required application code are not created during instance launch.

Current Behavior

  1. Template deploys successfully
  2. EC2 instances launch (both server and worker)
  3. Web interface loads and allows file uploads
  4. Files upload to S3 bucket successfully
  5. SQS messages go into "in-flight" state but never get processed
  6. When SSH'ing into worker instance, the error shows: sh-4.2$ cd /home/ec2-user/worker sh: cd: /home/ec2-user/worker: Not a directory

Expected Behavior

The UserData script should either:

  • Install required Node.js applications and code
  • OR documentation should clearly indicate pre-requisite steps for installing the required application code before deploying the template

Steps to Reproduce

  1. Clone repository
  2. Deploy chapter16/template.yaml using CloudFormation
  3. Access the web interface through ALB URL
  4. Upload an image
  5. Image stays in "uploaded" state
  6. Check SQS queue - messages remain "in-flight"
  7. SSH into worker instance - worker directory doesn't exist

Additional Context

The template's UserData sections assume the existence of:

  • /home/ec2-user/worker/worker.js
  • /home/ec2-user/server/server.js

But these files and their containing directories are not created during instance launch.

arahas avatar Feb 05 '25 14:02 arahas

Hi @arahas ch16 uses a custom AMI that includes the application under /home/ec2-user/?

michaelwittig avatar Feb 12 '25 19:02 michaelwittig