Skip to content

Commit

Permalink
Nginx conf update and change instance type (#45)
Browse files Browse the repository at this point in the history
Signed-off-by: Prudhvi Godithi <[email protected]>
  • Loading branch information
prudhvigodithi authored Jun 25, 2024
1 parent 21ca56a commit f302c84
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
14 changes: 11 additions & 3 deletions infrastructure/lib/stacks/opensearchNginxProxyReadonly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ export class OpenSearchMetricsNginxReadonly extends Stack {

const instanceRole = this.createNginxReadonlyInstanceRole(props);
this.asg = new AutoScalingGroup(this, 'OpenSearchMetricsReadonly-MetricsProxyAsg', {
instanceType: InstanceType.of(InstanceClass.M5, InstanceSize.LARGE),
blockDevices: [{ deviceName: '/dev/xvda', volume: BlockDeviceVolume.ebs(10) }], // GB
instanceType: InstanceType.of(InstanceClass.M5, InstanceSize.XLARGE),
blockDevices: [{ deviceName: '/dev/xvda', volume: BlockDeviceVolume.ebs(50) }], // GB
healthCheck: HealthCheck.ec2({ grace: Duration.seconds(90) }),
machineImage: props && props.ami ?
MachineImage.fromSsmParameter(props.ami) :
Expand Down Expand Up @@ -181,6 +181,14 @@ export class OpenSearchMetricsNginxReadonly extends Stack {
proxy_set_header X-Real-IP $remote_addr; # Set the X-Real-IP header
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # Set the X-Forwarded-For header
proxy_set_header X-Forwarded-Proto $scheme; # Set the X-Forwarded-Proto header
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
send_timeout 60s;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
proxy_temp_file_write_size 256k;
}
}'`;
}
Expand All @@ -197,7 +205,7 @@ export class OpenSearchMetricsNginxReadonly extends Stack {
'sudo yum install docker -y',
'sudo systemctl enable docker',
'sudo systemctl start docker',
`docker run --rm -tid -v ~/.aws:/root/.aws -p 8081:8080 public.ecr.aws/aws-observability/aws-sigv4-proxy:1.8 -v --name es --region ${nginxProps.region}`
`docker run --rm -tid -v ~/.aws:/root/.aws -p 8081:8080 --log-opt max-size=50m --log-opt max-file=5 public.ecr.aws/aws-observability/aws-sigv4-proxy:1.8 -v --name es --region ${nginxProps.region}`
];
}

Expand Down
11 changes: 11 additions & 0 deletions infrastructure/test/nginx.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@ test('OpenSearchMetricsNginxReadonly Stack Test', () => {
]
});
template.resourceCountIs('AWS::AutoScaling::LaunchConfiguration', 1);
template.hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', {
"InstanceType": "m5.xlarge",
"BlockDeviceMappings": [
{
"DeviceName": "/dev/xvda",
"Ebs": {
"VolumeSize": 50
}
}
],
});
});

test('OpenSearchMetricsNginxCognito Test', () => {
Expand Down

0 comments on commit f302c84

Please sign in to comment.