Setup Environment & Run application using Elastic Beanstalk.
Download a working application version from Elastic beanstalk from the existing environment.
Use platform settings if needed and add permission to the files as follows:
chmod +x .platform/hooks/postdeploy/01_managePermissions.sh
Create a new Environment.
Go to Elastic Beanstalk.
Create a new Environment. https://us-west-2.console.aws.amazon.com/elasticbeanstalk/home?region=us-west-2#/environments
Select environment tier → Web server environment.
Enter
Application Name,
Environment Name
Domain name [Optional]
Platform → Managed platform
Platform → PHP
Platform branch → PHP 8.0 running on 64bit Amazon Linux 2
Platform version → 3.3.6 (Recommended)
Application code → Upload your code
Source code origin → Local file → Choose file → Upload a working application version downloaded from Elastic beanstalk from the existing environment.
Click on → Configure more options
Set up Environment configuration page
Modify software :
Proxy server → apache
Document root → /public
Environment properties → [Provide the key-value pair for setting Environment variables.]
ENVIRONMENT: Staging/Production
Modify instances :
Root volume type → General Purpose (SSD)
Size → 50GB
EC2 security groups → [Select the security group for access]
Modify capacity :
Auto scaling group → Environment type → Load Balancer
Scaling triggers → CPU Utilization → Percentage [70, 20]
Load Balancer : [Do later for HTTPS to avoid grey status]
Add this once the Environment is ready to avoid any failure.
Listeners → add 443 HTTPS
[Use Valid certificate from ACM
Check the HTTPS access using the test domains defined on Route53.]
Rolling updates and deployments :
Deployment policy → Rolling with additional batch
Rolling update type → Rolling based on Health. [If multiple instances available]
Security :
Virtual machine permissions → Choose EC2 key pair
Monitoring :
Health reporting → Basic
Click on → Create Environment
Deployment to the new Environment using Pipeline.
Update Pipeline with correct Application & Environment for deployment.
Run the pipeline to deploy updated code to the new environment.
Use the Domain name on Postman to verify the functionality.