๐ Deploying Odoo 18 on AWS with Secure VPC and Auto-Scaling โ A Complete Guide


๐งญ Introduction
In this blog, we walk through a real-world project where we deploy Odoo 18 Community Edition on AWS using best practices in architecture and security. The goal is to implement a flexible and scalable ERP solution that supports a variety of communication protocols including XMLRPC, JSONRPC, webhooks, MQTT/s, HTTP/s, and PostgreSQL-based DB communication.
This guide is useful for:
Freelancers deploying ERP systems for clients.
AWS enthusiasts building production-ready architecture.
Teams planning to scale Odoo deployments.
๐ฆ Use Case
The client required:
A secure Odoo 18 deployment on AWS.
Communication support for webhooks, APIs, and MQTT.
High availability and scalability.
Centralized PostgreSQL database (with optional decoupling from the app server).
Integration and development with PyCharm.
Scheduled backups and easy restore.
โ Step-by-Step Procedure
๐ง Step 1: Create a VPC in AWS
1.1 Create a VPC
Open AWS Console โ VPC โ Create VPC
Name:
odoo-vpc
IPv4 CIDR block:
10.0.0.0/16
Tenancy: Default
1.2 Create Subnets
Public subnet:
10.0.1.0/24
(for NAT Gateway or LB)Private subnet for App:
10.0.2.0/24
Private subnet for DB:
10.0.3.0/24
1.3 Create and Attach Internet Gateway
- Create IGW โ Attach to
odoo-vpc
1.4 Create Route Table
Public RT: routes
0.0.0.0/0
โ IGWAssociate public subnet with this RT
Private RT: optionally use NAT gateway
1.5 Configure Security Groups
Create security group: odoo-sg
Allow Inbound:
Port 8069 (Odoo XMLRPC/JSONRPC/Web)
Port 443, 80 (HTTPS, HTTP)
Port 1883, 8883 (MQTT, MQTTs)
Port 5432 (PostgreSQL)
Restrict source to your IP for better security
๐ Step 2: Deploy Odoo 18 on Ubuntu
๐ Option A: DB and Odoo on the Same Server
2.1 Launch EC2 Instance
OS: Ubuntu 24.04 LTS
Instance type: t3.medium or higher
Security group:
odoo-sg
2.2 Install Required Packages
bashCopyEditsudo apt update && sudo apt install -y git python3-pip build-essential wget python3-dev python3-venv libpq-dev
2.3 Install PostgreSQL and Create Odoo User
bashCopyEditsudo apt install postgresql -y
sudo su - postgres
createuser -s odoo18
exit
2.4 Clone Odoo
bashCopyEditsudo mkdir -p /opt/odoo18 && cd /opt/odoo18
sudo git clone https://www.github.com/odoo/odoo --depth 1 --branch 18.0 .
python3 -m venv venv && source venv/bin/activate
pip install wheel && pip install -r requirements.txt
2.5 Create Config File
bashCopyEditsudo nano /etc/odoo18.conf
Paste:
iniCopyEdit[options]
db_user = odoo18
addons_path = /opt/odoo18/addons
logfile = /var/log/odoo18/odoo.log
2.6 Create systemd Service
bashCopyEditsudo nano /etc/systemd/system/odoo18.service
Paste:
iniCopyEdit[Unit]
Description=Odoo18
After=network.target postgresql.service
[Service]
Type=simple
User=ubuntu
ExecStart=/opt/odoo18/venv/bin/python3 /opt/odoo18/odoo-bin -c /etc/odoo18.conf
Restart=always
[Install]
WantedBy=multi-user.target
Then:
bashCopyEditsudo systemctl daemon-reexec
sudo systemctl enable odoo18
sudo systemctl start odoo18
๐งฉ Option B: DB and App on Separate Servers
DB Server (10.0.3.10)
bashCopyEditsudo apt install postgresql -y
sudo nano /etc/postgresql/16/main/postgresql.conf
# set listen_addresses = '*'
Edit pg_hba.conf:
bashCopyEditsudo nano /etc/postgresql/16/main/pg_hba.conf
# Add: host all all 10.0.0.0/16 md5
Restart PostgreSQL:
bashCopyEditsudo systemctl restart postgresql
sudo -u postgres createuser -s odoo18
sudo -u postgres psql
ALTER USER odoo18 WITH PASSWORD 'your-password';
App Server (10.0.2.10)
Follow Option A but:
Update config:
iniCopyEditdb_host = 10.0.3.10
db_port = 5432
db_user = odoo18
db_password = your-password
Restart Odoo:
bashCopyEditsudo systemctl restart odoo18
๐งโ๐ป Step 3: PyCharm Setup
Clone Odoo repo locally
PyCharm โ File โ Settings โ Project Interpreter โ Add โ Virtualenv โ point to
/opt/odoo18/venv/bin/python
Set breakpoints
Use SSH or remote interpreter plugin for debugging
๐ Step 4: Auto Scaling
Create AMI from Odoo EC2 instance
Create Launch Template
Create Auto Scaling Group:
Use template
Attach to target group in ALB
Subnets: private App subnet
Define scaling policies based on CPU > 60%
๐พ Step 5: Backup and Restore
Backup
bashCopyEditpg_dump -U odoo18 -h 10.0.3.10 -Fc -f /home/ubuntu/odoo18_db_backup.dump db_name
Automate via cron:
bashCopyEditcrontab -e
0 1 * * * /usr/bin/pg_dump -U odoo18 -h 10.0.3.10 -Fc -f /backups/db_$(date +\%F).dump db_name
Restore
bashCopyEditpg_restore -U odoo18 -h 10.0.3.10 -d new_db_name /home/ubuntu/odoo18_db_backup.dump
โ Conclusion
In this end-to-end deployment, we:
Built a secure VPC with necessary protocol support
Deployed Odoo 18 on Ubuntu
Integrated PostgreSQL with same or separate server
Used PyCharm for development
Set up autoscaling and backup for production readiness
This architecture ensures scalability, flexibility, and maintainability, and can be adapted for most enterprise-grade Odoo deployments.
๐ "This step-by-step Odoo 18 deployment guide was generated with the help of ChatGPT by OpenAI."
Subscribe to my newsletter
Read articles from Sudharsanam V directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Sudharsanam V
Sudharsanam V
Welcome to Cloud Brilliance, a dedicated platform focused on simplifying AWS and cloud computing concepts. We provide clear, practical insights designed to help learners at all levels build a strong foundation and advance their skills in the cloud domain. Our content covers AWS services, architecture best practices, certifications, and industry-relevant use cases. Whether you are starting your cloud journey or looking to deepen your expertise, this blog serves as a trusted resource to support your professional growth in cloud technology.