Deployment of Stack to Elastic BeanStalk

Deployment of Stack to Elastic BeanStalk

Introduction

AWS Elastic Beanstalk is an easy-to-use service for deploying and scaling web applications that abstracts away infrastructure management, making it highly valuable for development stacks. It allows developers to simply upload their code while automatically provisioning and managing underlying resources like EC2 instances, load balancers, and auto-scaling.

Need for Stack Deployment to Elastic BeanStalk

A developer deploys a Dev stack to Elastic Beanstalk primarily to accelerate iteration speed and ensure consistency between development and production environments, thereby preventing common integration issues. A crucial scenario where this deployment is indispensable is for permission validation: When the action or resource within an IAM policy is changed. In this case the only reliable way to validate the change is to perform a full deployment. Unlike simple local builds via Jenkins/GitHub, an actual deployment test forces the underlying IAM role assumed by the Beanstalk environment to execute the sensitive actions, immediately verifying if the new, more restrictive policy works without breaking the deployment pipeline.

How to deploy the stack

  1. Verify and delete all existing CloudWatch log groups associated with the stack prior to deployment.

    Screen Shot 2025-10-17 at 1.40.36 PM (2).png

 

  1. Before deployment, verify that the deployment binary for the version you intend to use is entirely absent from s3 bucket dev-configuration.sagebase.org/versions. There is three folder in s3 bucket portal, services-repository and services-workers because three stacks will be deployed, all should not contain the binary of version which need to be deployed. As a safety measure to prevent conflicts, always select a version number lower than the one currently active in the Main stack; for example, if the Main stack is running version 564, prefer using 563 or an older version for your current deployment.

    Screen Shot 2025-10-17 at 1.42.29 PM (2).png

 

  1. Check and delete any existing CloudFormation stacks with the same name before building a new one.

  2. Create a new stack http://build-system-ops.dev.sagebase.org:8080/job/build-test-stack/ with parameters as below.

    Screen Shot 2025-10-17 at 1.38.25 PM (2).png

 

  1. Once the CloudFormation stack successfully builds, the Elastic Beanstalk environment will be visible.

    Screen Shot 2025-10-17 at 1.44.50 PM.png

 

Check Log

If the environment health is degraded or you are investigating an issue, consult the multiple available logging options for diagnosis.

 

  1. Check the environment log.

    Screen Shot 2025-10-17 at 1.53.37 PM.png

 

  1. Check the instance log by connecting to the instance. click on “Connect” button.

    Screen Shot 2025-10-17 at 1.54.49 PM.png
Screen Shot 2025-10-17 at 1.54.49 PM.png

Run below command to get latest log.

Screen Shot 2025-10-17 at 1.58.59 PM.png