Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: migrate to AWS SDK v3 #310

Merged
merged 1 commit into from
Oct 18, 2024
Merged

fix: migrate to AWS SDK v3 #310

merged 1 commit into from
Oct 18, 2024

Conversation

rowanmanning
Copy link
Member

@rowanmanning rowanmanning commented Oct 18, 2024

This is important for several reasons:

  1. AWS SDK v2 is no longer supported which is a risk. It also outputs very annoying deprecation warnings all the time

  2. AWS SDK v2 is 98.1 MB!!! That's too big and it means that every single app that uses n-express will be installing aws-sdk regardless of whether it's actually used. The CloudWatch client is a still-not-great-but-much-better 1MB.

Testing locally

This is fairly easy to test locally. You need to get credentials for the FT Tech Infrastructure Prod AWS account and export them as environment variables. You can do this via AWS Login - click Access keys instead of FT-Engineer.

Now add the following to a new JavaScript file and run it via node. You should see health check output:

const alarmCheck = require('./main').runCheck({
	id: 'test-check-1',
	name: 'test check',
	severity: 1,
	businessImpact: 'Just a test',
	panicGuide: 'Just a test',
	technicalSummary: 'Just a test',
	type: 'cloudWatchAlarm',
	cloudWatchRegion: 'eu-west-1',
	cloudWatchAlarmName: 'ft-email_platform_tps_lookup-WriteCapacityUnitsLimit-BasicAlarm'
});

const thresholdCheck = require('./main').runCheck({
	id: 'test-check-2',
	name: 'test check',
	severity: 1,
	businessImpact: 'Just a test',
	panicGuide: 'Just a test',
	technicalSummary: 'Just a test',
	type: 'cloudWatchThreshold',
	cloudWatchRegion: 'eu-west-1',
	cloudWatchNamespace: 'AWS/ES',
	cloudWatchMetricName: 'ClusterStatus.yellow',
	cloudWatchStatistic: 'Average',
	cloudWatchDimensions: [
		{ Name: 'DomainName', Value: 'next-elasticsearch-v7' },
		{ Name: 'ClientId', Value: '027104099916' }
	],
	samplePeriod: 300,
	threshold: 0
});

setTimeout(() => {
	console.log(alarmCheck.getStatus());
	console.log(thresholdCheck.getStatus());
	process.exit(0);
}, 2000);

See-also: CPREL-1201

This is important for several reasons:

  1. AWS SDK v2 is no longer supported which is a risk. It also outputs
     very annoying deprecation warnings all the time

  2. AWS SDK v2 is 98.1 MB!!! That's too big and it means that every
     single app that uses n-express will be installing aws-sdk
     regardless of whether it's actually used. The CloudWatch client is
     a still-not-great-but-much-better 1MB.

See-also: https://financialtimes.atlassian.net/browse/CPREL-1201
Copy link
Member

@alexmuller alexmuller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Really good size saving. This is giving the same output for me locally 👍

@rowanmanning rowanmanning merged commit 208f2cf into main Oct 18, 2024
14 checks passed
@rowanmanning rowanmanning deleted the aws-sdk-update branch October 18, 2024 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants