-
Notifications
You must be signed in to change notification settings - Fork 461
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adding alarm that monitors %xx errors in IAM
- Loading branch information
Showing
1 changed file
with
29 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ import * as aws from "@pulumi/aws"; | |
import * as op from "@1password/op-js"; | ||
import * as cloudflare from "@pulumi/cloudflare"; | ||
import { secretsManager, amplify } from "infra-libs"; | ||
import {stack, defaultTags} from "../lib/tags"; | ||
import { stack, defaultTags } from "../lib/tags"; | ||
|
||
const current = aws.getCallerIdentity({}); | ||
const regionData = aws.getRegion({}); | ||
|
@@ -40,8 +40,6 @@ const snsAlertsTopicArn = coreInfraStack.getOutput("snsAlertsTopicArn"); | |
const passportXyzDomainName = coreInfraStack.getOutput("passportXyzDomainName"); | ||
const passportXyzHostedZoneId = coreInfraStack.getOutput("passportXyzHostedZoneId"); | ||
|
||
|
||
|
||
const containerInsightsStatus = stack == "production" ? "enabled" : "disabled"; | ||
|
||
// Manage secrets & envs for Passport XYZ | ||
|
@@ -309,6 +307,30 @@ const albPassportXyzTargetGroup = new aws.lb.TargetGroup(`passport-xyz-iam`, { | |
}, | ||
}); | ||
|
||
/* | ||
* Alarm for monitoring target 5XX errors | ||
*/ | ||
const httpsListenerAlbPrefix = albHttpsListenerArn.apply((arn) => arn.split(":").pop()); | ||
const http5xxTargetAlarm = new aws.cloudwatch.MetricAlarm(`HTTP-Target-5XX-passport-xyz-iam`, { | ||
tags: { ...defaultTags, Name: `HTTP-Target-5XX-passport-xyz-iam` }, | ||
name: `HTTP-Target-5XX-passport-xyz-iam`, | ||
alarmActions: [snsAlertsTopicArn], | ||
okActions: [snsAlertsTopicArn], | ||
|
||
period: 60, | ||
statistic: "Sum", | ||
|
||
datapointsToAlarm: 3, | ||
evaluationPeriods: 5, | ||
|
||
metricName: "HTTPCode_Target_5XX_Count", | ||
namespace: "AWS/ApplicationELB", | ||
|
||
comparisonOperator: "GreaterThanThreshold", | ||
threshold: 0, | ||
treatMissingData: "notBreaching", | ||
}); | ||
|
||
const albPassportXyzListenerRule = new aws.lb.ListenerRule(`passport-xyz-iam-https`, { | ||
listenerArn: albHttpsListenerArn, | ||
priority: 102, // This needs to be grater than the priority number for passport-scroll-badge-service | ||
|
@@ -660,7 +682,7 @@ const ecsAutoScalingTargetXyz = new aws.appautoscaling.Target("autoscaling_targe | |
tags: { | ||
...defaultTags, | ||
Name: "autoscaling_target_xyz", | ||
} | ||
}, | ||
}); | ||
|
||
const ecsAutoScalingPolicyXyz = new aws.appautoscaling.Policy("passport-autoscaling-policy-xyz", { | ||
|
@@ -793,7 +815,7 @@ const gitcoinEcsAutoScalingTarget = new aws.appautoscaling.Target("autoscaling_t | |
tags: { | ||
...defaultTags, | ||
Name: "autoscaling_target", | ||
} | ||
}, | ||
}); | ||
|
||
const gitcoinEcsAutoScalingPolicy = new aws.appautoscaling.Policy("passport-autoscaling-policy", { | ||
|
@@ -852,7 +874,8 @@ const amplifyAppInfo = coreInfraStack.getOutput("newPassportDomain").apply((doma | |
branchName: passportBranches[stack], | ||
environmentVariables: passportXyzAppEnvironment, | ||
tags: { ...defaultTags, Name: `${prefix}.${domainName}` }, | ||
buildCommand: "npm install --g [email protected] && lerna bootstrap && rm -rf ../node_modules/@tendermint && npm run build", | ||
buildCommand: | ||
"npm install --g [email protected] && lerna bootstrap && rm -rf ../node_modules/@tendermint && npm run build", | ||
preBuildCommand: "nvm use 20.9.0", | ||
artifactsBaseDirectory: "out", | ||
customRules: [ | ||
|