| """ |
| EC2 Instance Configuration Templates |
| """ |
|
|
| |
| INSTANCE_CONFIGS = { |
| 'web_server': { |
| 'name': 'WebServer-Production', |
| 'ami_id': 'ami-0c55b159cbfafe1f0', |
| 'instance_type': 't3.medium', |
| 'key_name': 'production-key', |
| 'security_groups': ['sg-0123456789abcdef0'], |
| 'environment': 'production' |
| }, |
| |
| 'database': { |
| 'name': 'Database-MySQL', |
| 'ami_id': 'ami-0c55b159cbfafe1f0', |
| 'instance_type': 't3.large', |
| 'key_name': 'production-key', |
| 'security_groups': ['sg-0123456789abcdef1'], |
| 'environment': 'production' |
| }, |
| |
| 'dev_server': { |
| 'name': 'DevServer-Testing', |
| 'ami_id': 'ami-0c55b159cbfafe1f0', |
| 'instance_type': 't3.small', |
| 'key_name': 'dev-key', |
| 'security_groups': ['sg-0123456789abcdef2'], |
| 'environment': 'development' |
| }, |
| |
| 'worker': { |
| 'name': 'Worker-Node', |
| 'ami_id': 'ami-0c55b159cbfafe1f0', |
| 'instance_type': 't3.micro', |
| 'key_name': 'worker-key', |
| 'security_groups': ['sg-0123456789abcdef3'], |
| 'environment': 'production' |
| } |
| } |
|
|
| |
| USER_DATA_SCRIPTS = { |
| 'web_server': """#!/bin/bash |
| yum update -y |
| yum install -y httpd |
| systemctl start httpd |
| systemctl enable httpd |
| echo "<h1>Web Server Running</h1>" > /var/www/html/index.html |
| """, |
| |
| 'database': """#!/bin/bash |
| yum update -y |
| yum install -y mysql-server |
| systemctl start mysqld |
| systemctl enable mysqld |
| """, |
| |
| 'worker': """#!/bin/bash |
| yum update -y |
| yum install -y python3 python3-pip |
| pip3 install boto3 celery redis |
| """ |
| } |
|
|