Deploying on AWS Elastic Beanstalk

AWS Elastic Beanstalk natively supports Tomcat with an RDS instance for the PostgreSQL database.

Requirements

Step 1: Install AWS CLI and EB CLI

On your Linux environment:

# Verify Python installation
python3 --version

# Install pip if needed
sudo apt update
sudo apt install python3-pip

# Install pipx (recommended for isolated environments)
sudo apt install pipx
pipx ensurepath

# Reload shell configuration
source ~/.bashrc

# Install AWS CLI
pipx install awscli

# Verify installation
aws --version

# Configure CLI
aws configure

# Install EB CLI
pipx install awsebcli

# Verify installation
eb --version

Step 2: Create RDS Instance

You need to create a RDS instance for the database. See Create RDS Instance page.

Step 3: Prepare Your Project

Set your variables in configuration files environment.config and tomcat-context.config.

Your project structure should look like:

jira-broker-deploy/
├── your-application.war
└── .ebextensions/
    ├── environment.config
    ├── jvm-options.config
    ├── tomcat-context.config
    └── https-loadbalancer.config

Step 4: First-Time Elastic Beanstalk Setup

Admin Tasks (One-Time Setup)

If this is the first Elastic Beanstalk deployment in your AWS account, an administrator needs to create IAM roles and S3 bucket:

  1. Navigate to Elastic Beanstalk in AWS Console
  2. Click Create application
  3. Choose any platform (e.g., Python)
  4. Use sample application
  5. Click Create
  6. Once created, delete the application (roles and bucket remain)

Initialize and Create Environment

# Navigate to your deployment directory
cd ~/jira-broker-deploy

# Initialize EB
eb init

# Answer prompts:
# - Select region: your region (e.g., 3 for eu-west-1)
# - Application name: jira-broker (or your preference)
# - Platform: Tomcat
# - Platform branch: Tomcat 11 with Corretto 11 running on 64bit Amazon Linux 2023
# - CodeCommit: n (no)
# - SSH: y (yes, recommended)
# - Keypair: create new or select existing

# Create EB environment
eb create jira-broker-env

Step 5: Allow Elastic Beanstalk to Access RDS

Via AWS Console:

  1. Navigate to RDSDatabases
  2. Click on jira-broker-postgres
  3. Go to Connectivity & security tab
  4. Click on the VPC security groups link
  5. Click Edit inbound rules
  6. Click Add rule:
  7. Click Save rules

Verify Database Connection

# SSH into EB instance
eb ssh

# Test network connectivity
telnet jira-broker-postgres.xxxxx.rds.amazonaws.com 5432

# Test with psql (if installed)
psql -h jira-broker-postgres.xxxxx.rds.amazonaws.com \
    -U your_database_user \
    -d broker

exit

Step 6: Configure HTTPS with Load Balancer

Import Certificate to AWS Certificate Manager

# Import certificate
aws acm import-certificate \
    --certificate fileb://certificate.crt \
    --private-key fileb://private.key \
    --region eu-west-1

Copy the returned ARN (e.g., arn:aws:acm:eu-west-1:123456789012:certificate/abcd1234-...) and replace it in SSLCertificateArns in https-loadbalancer.config.

Step 7: Deploy Configuration

cd ~/jira-broker-deploy
eb deploy

Step 8: Access Your Application

# Get load balancer URL
eb status | grep CNAME

Broker should be available at: https://{load_balancer_url}/oslc-connect-jira

Useful Commands

# Deploy new version
eb deploy

# View application logs
eb logs

# View real-time logs
eb logs --stream

# SSH into instance
eb ssh

# Check environment status
eb status

# Update environment variables
eb setenv DB_PASSWORD=new_password

# Open application in browser
eb open

# Terminate environment (stops billing)
eb terminate production-env

# Recreate environment
eb create production-env

# Check Tomcat logs
eb ssh
sudo tail -200 /var/log/tomcat11/catalina.out
sudo journalctl -u tomcat11 -n 200
exit

# Check application health
eb health

# View detailed logs
eb logs --all