Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"s3:CreateBucket",
"s3:PutObject"
]
}));
// Create alarm for any errors
const error_alarm = new cloudwatch.Alarm(this, "error_alarm", {
metric: new cloudwatch.Metric({
namespace: 'cloudtrail_partitioner',
metricName: "errors",
statistic: "Sum"
}),
threshold: 0,
evaluationPeriods: 1,
datapointsToAlarm: 1,
treatMissingData: cloudwatch.TreatMissingData.NOT_BREACHING,
alarmDescription: "Detect errors",
alarmName: "cloudtrail_partitioner_errors"
});
// Create SNS for alarms to be sent to
const sns_topic = new sns.Topic(this, 'cloudtrail_partitioner_alarm', {
displayName: 'cloudtrail_partitioner_alarm'
});
// Connect the alarm to the SNS
error_alarm.addAlarmAction(new cloudwatch_actions.SnsAction(sns_topic));
// Create Lambda to forward alarms
const alarm_forwarder = new lambda.Function(this, "alarm_forwarder", {
runtime: lambda.Runtime.PYTHON_3_7,
code: lambda.Code.asset("resources/alarm_forwarder"),
taskDefinition: taskDefinition,
subnetSelection: {subnetType: ec2.SubnetType.PUBLIC}
})]
});
// Create alarm for any errors
const error_alarm = new cloudwatch.Alarm(this, "error_alarm", {
metric: new cloudwatch.Metric({
namespace: 'cloudmapper',
metricName: "errors",
statistic: "Sum"
}),
threshold: 0,
evaluationPeriods: 1,
datapointsToAlarm: 1,
treatMissingData: cloudwatch.TreatMissingData.NOT_BREACHING,
alarmDescription: "Detect errors",
alarmName: "cloudmapper_errors"
});
// Create SNS for alarms to be sent to
const sns_topic = new sns.Topic(this, 'cloudmapper_alarm', {
displayName: 'cloudmapper_alarm'
});
// Connect the alarm to the SNS
error_alarm.addAlarmAction(new cloudwatch_actions.SnsAction(sns_topic));
// Create Lambda to forward alarms
const alarm_forwarder = new lambda.Function(this, "alarm_forwarder", {
runtime: lambda.Runtime.PYTHON_3_7,
code: lambda.Code.asset("resources/alarm_forwarder"),