Deploys a production-style setup with two Instances, A web server on a public network and a MySQL database on a private network. The database is not exposed to the internet.
Architecture:
2 Instances (Nano for web, NanoBoost for DB)
1 private network (10.200.0.0/24)
1 floating IP (web server only)
Web server: 30 GB boot volume
DB server: 50 GB boot volume
Separate security groups per Instance
What is automated:
Both Instances created with selected image
Private network, subnet, and router
Floating IP assigned to web server only
Web security group: ports 22, 80, 443 (public)
DB security group: port 22 (public), port 3306 (10.200.0.0/24 only)
MySQL installed with random root and app user passwords
MySQL bound to 0.0.0.0 (access controlled by security group)
Web server receives DB private IP via template injection
Credentials saved to /root/.db_credentials on DB server
Before you launch:
Update these parameters in the template or at launch time:
Parameter
Default
What to change
key_name
stack-test
Required. Replace with your SSH keypair name from Compute - Key Pairs.
image
Ubuntu 22.04 Updated
Change only if you need a different OS image.
web_flavor
Nano
Flavor for the web server Instance.
db_flavor
NanoBoost
Flavor for the database Instance.
web_volume_size
30
Boot volume for web server (in GB).
db_volume_size
50
Boot volume for database (in GB).
public_network
Public
Do not change unless your cloud has a different external network name.
key_name is the only parameter you must change before launching. Everything else works with defaults.
Web and MySQL Template
Save as web-mysql-stack.yaml and upload via Orchestration or Past Direct.
Access:
Web: http://floating-ip
SSH to web: ssh ubuntu@floating-ip
SSH to DB: hop through web Instance, then ssh to private IP
MySQL: accessible from web Instance at private IP on port 3306