From f302c84201bde62625b1cdf874eb72077ffeb70f Mon Sep 17 00:00:00 2001 From: Prudhvi Godithi Date: Tue, 25 Jun 2024 14:43:58 -0700 Subject: [PATCH] Nginx conf update and change instance type (#45) Signed-off-by: Prudhvi Godithi --- .../lib/stacks/opensearchNginxProxyReadonly.ts | 14 +++++++++++--- infrastructure/test/nginx.test.ts | 11 +++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/infrastructure/lib/stacks/opensearchNginxProxyReadonly.ts b/infrastructure/lib/stacks/opensearchNginxProxyReadonly.ts index e7ee7bc..cc075e3 100644 --- a/infrastructure/lib/stacks/opensearchNginxProxyReadonly.ts +++ b/infrastructure/lib/stacks/opensearchNginxProxyReadonly.ts @@ -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) : @@ -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; } }'`; } @@ -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}` ]; } diff --git a/infrastructure/test/nginx.test.ts b/infrastructure/test/nginx.test.ts index ce2c600..6c74c14 100644 --- a/infrastructure/test/nginx.test.ts +++ b/infrastructure/test/nginx.test.ts @@ -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', () => {