AWS Setup
Infrastructure
The above diagram shows which services on AWS we are currently using and how they are inter-related. In summary, there is an Elastic Beanstalk environment for each of our 3 environments (dev, qa, prod) that is backed by a postgres database and elasticsearch cluster. One redis (AWS calls this ElasticCache) handles all three environments and there are several SQS queues/lambdas used to interact with the above. The actual website files are in S3 buckets and are served by the CloudFront CDN (this is also where https is added). DNS is handled by Route53
Security Groups / VPC access
For remote access, the preferred method is to VPN with your credentials to vpn.titanhouseapp.net. At its simplest, there is a Security Group named dev-access that is a whitelist of IPs allowed to access resources; adding a home IP address here will achieve the same thing as tunneling through the VPN.
RDS
There is one postgres instance for each environment. Within postgres there is one database (titanhouse) with different schemas for each service. The one exception to this is the titanportal, which uses its own database.
DEV | QA | PRODUCTION | |
---|---|---|---|
Name | instance-dev | instance-qa | instance-live |
Size | db.t3.medium | db.t2.xlarge | db.t2.xlarge |
Note: if a reindex (as opposed to a rebatch) needs to take place, the DB must be resized prior (something in the neighborhood of a db.m4.xl).
Elasticsearch Service
Currently each environment has its own elastic cluster. Within the cluster there can be as many indexes as will fit in the amount of space available. Each node provides 35GB of storage. Each used index has two aliases name and name_new. The live updates are always added to name_new while the API serves data from name. This allows for a new index to be created and filled without disrupting app usage until this process finishes. When both aliases point to the same index (which is the case most of the time), live updates from RT are immediately visible.
DEV | QA | PRODUCTION | |
---|---|---|---|
Name | elastic | elastic-temp | elastic-uat |
Size | t2.small.elasticsearch (6) | t2.medium.elasticsearch (6) | t2.medium.elasticsearch (8) |
Elastic Beanstalk
This is where the backend comes together. Each environment is backed by one or more EC2 instances. The name in the table below is a link to the configuration for that environment. There are really only two places you'll need to be looking at regularly. First is Software, which is where the environment variables can be modified. Next is the Health/Monitoring tabs where you can check to see if/when things are failing.
DEV | QA | PRODUCTION | |
---|---|---|---|
Name | Services-DEV-development | Services-QA-staging | Services-PROD-master |
URL | https://api.dev.titanhouse.com/ | https://api.qa.titanhouse.com/ | https://api.titanhouse.com/ |
Size | t3.small | t3.small | t2.medium |
Scaling | 1-2 | 1-2 | 3-4 |
S3 / CloudFront
CloudFront
Old stuff below
Costs
9-7-2018
UAT
State | Elastic | Postgres | PG readonly | API:frontend | API:pipeline | $$ |
---|---|---|---|---|---|---|
normal | t2.med (4) | db.t2.xl | db.t2.small | t2.small (3) | t3.xl | |
$$/month | 33.87 x 4 | 211.70 | 26.28 | 16.79 x 3 | 135.49 | $559.32 |
rebatch | c4.large (4) | db.t2.2xl | db.t2.small | t2.small (3) | c5.4xl | |
$$/month | 73.00 x 4 | 423.40 | 26.28 | 16.79 x 3 | 496.40 | $1,288.45 |
QA
State | Elastic | Postgres | PG readonly | API:frontend | API:pipeline | $$ |
---|---|---|---|---|---|---|
normal | t2.small (4) | db.t2.med | t2.small (1) | |||
$$/month | 16.79 x 4 | 53.29 | 16.79 x 1 | $154.03 |