APRHBD Stack Infra Request

h1. Request Details

h2. Background

Accommodation product is planning to migrate hotel booking-related data to its own database in near future. In order to have clear ownership for the database, as well as decouple and transform our current system towards microservices, we want to create a new stack of infra that will be responsible to handle all request data related to booking process, such as hotel booking data, hotel booking history, and booking special request.

To achieve full ownership of those data and ease future data migration process, we need to migrate all service that retrieve the data both via hb-app and direct access to database to this new service. It will centralize all governance related to the data without exposing other unrelated business logic, which should be hosted in hb.

Creating this service will reduce load in hb, remove direct access from various services to the database, as well as shaping our system better. At the same time during the project, we will be able to map all data access and eliminate any tech debts and unneeded access. With this request, we are requesting EC2 and ELB.

Related feature design document:

h2. Purpose

h2. Impact

The service will reduce the load of and coupling from hb and make accommodation product infra more resilient. It will also introduce clear ownership of the data and separation of concern between booking business logic and booking data access.

h2. Risk

The following existing instances will have increased CPU usage and latency since there will be additional call to the service for several features (Connection to APRHBD):

Increase load on database servers (Connection from APRHBD):

Traffic estimation:

h2. Resources
h3. EC2
h4. Configuration

{code}
count = "4"
instance_type = "r4.xlarge"
ebs_optimized = "false"
disable_api_termination = "false"

root_block_device = {
volume_type = "gp2"
volume_size = "8"
delete_on_termination = "true"
}

tags = {
Service = "aprhbd"
Cluster = "aprhbd"
ProductDomain = "apr"
Application = "java-7"
Environment = "production"
Description = "Accom Product Hotel Booking Data"
}
{code}

h3. ALB
h4. Configuration

{code}
name = "aprhbd-lbint-01"
security_groups = "aprhbd-lbint"
internal = "true"
idle_timeout = "60"
enable_deletion_protection = "false"

tags = {
Name = "aprhbd-lbint-01"
Service = "aprhbd"
ProductDomain = "apr"
Environment = "production"
Description = "Internal Accom hotel booking data service load balancer"
}
{code}

h4. Listener

{code}
port = "443"
protocol = "HTTPS"

default_action {
target_group_arn = "aprhbd-app" # target group to receive traffic
type = "forward"
}
{code}

h4. Target Group

{code}
name = "aprhbd-app"
port = "61023"
protocol = "HTTP"
deregistration_delay = "300"

tags = {
Name = "aprhbd-app"
Service = "aprhbd"
ProductDomain = "apr"
Environment = "production"
Description = "Target group for Accom hotel booking data service"
}

health_check = {
interval = "10"
path = "/healthcheck"
port = "traffic-port"
protocol = "HTTP"
timeout = "5"
healthy_threshold = "5"
unhealthy_threshold = "2"
matcher = "200"
}
{code}

h4. CNAME record

aprhbd.main.tvlk.cloud

h3. Connectivity

https://docs.google.com/spreadsheets/d/1m1gJ044cmO-XC5Erh7lYUXaPItF9ui0-XC3vHcUg_jA/edit#gid=0

h4. Rules

[^connectivity.csv]
SourceId, Destination, from_port, to_port, proto
aprhbd-lbint, aprhbd-app, 61023, 61023, TCP
aprhbd-app, hotel-mongod, 27017, 27017, TCP
hb-app, aprhbd-lbint, 443, 443, HTTPS
tv-app, aprhbd-lbint, 443, 443, HTTPS
aprafba-app, aprhbd-lbint, 443, 443, HTTPS
aprafop-app, aprhbd-lbint, 443, 443, HTTPS
aprbapi-app, aprhbd-lbint, 443, 443, HTTPS
aprcapi-app, aprhbd-lbint, 443, 443, HTTPS
aprops-app, aprhbd-lbint, 443, 443, HTTPS
aprpbo-app, aprhbd-lbint, 443, 443, HTTPS
mtepapi-app, aprhbd-lbint, 443, 443, HTTPS
paypapi-app, aprhbd-lbint, 443, 443, HTTPS
tap-app, aprhbd-lbint, 443, 443, HTTPS
trpiapi-app, aprhbd-lbint, 443, 443, HTTPS
trpops-app, aprhbd-lbint, 443, 443, HTTPS
usrpapi-app, aprhbd-lbint, 443, 443, HTTPS