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

Add external SNS topic trigger stack #1

Merged
merged 1 commit into from
Jul 19, 2024
Merged

Conversation

njmei
Copy link
Collaborator

@njmei njmei commented May 6, 2024

This PR adds a stack template for subscribing to an external SNS topic (in another AWS account) and triggering a lambda within the deploying AWS account.

This is expected to be useful in the future if we want to create additional triggers from PTS SNS topics or from other SNS topics.

@njmei njmei requested review from sheriferson, aamster and rpmcginty May 6, 2024 17:25
@njmei njmei force-pushed the add-external-sns-trigger-stack branch 4 times, most recently from c9ac77e to 3cb07cf Compare May 6, 2024 18:38
Comment on lines 111 to 124
self.triggered_lambda_dlq_alarm = cloudwatch.Alarm(
scope=self,
id=self.get_construct_id(triggered_lambda_fn_name, "dlq", "alarm"),
alarm_description=(
f"Alarm if more than 1 message in {triggered_lambda_dlq_name} in 10 minute period"
),
metric=self.triggered_lambda_dlq.metric_approximate_number_of_messages_visible(
statistic=cloudwatch.Stats.MAXIMUM,
period=cdk.Duration.minutes(10),
),
evaluation_periods=1,
threshold=1,
datapoints_to_alarm=1,
comparison_operator=cloudwatch.ComparisonOperator.GREATER_THAN_OR_EQUAL_TO_THRESHOLD,
Copy link
Collaborator

Choose a reason for hiding this comment

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

wonder if this should be configurable as well.

@njmei njmei force-pushed the add-external-sns-trigger-stack branch from 3cb07cf to be540ae Compare July 18, 2024 22:58
@njmei njmei changed the title [WIP] Add external SNS topic trigger stack Add external SNS topic trigger stack Jul 18, 2024
@njmei njmei requested a review from rpmcginty July 18, 2024 23:19
Copy link
Collaborator

@rpmcginty rpmcginty left a comment

Choose a reason for hiding this comment

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

left single comment about alarm

)
self.external_sns_event_queue.grant_consume_messages(triggered_lambda_fn)

# Alarm that fires if external_sns_event_queue fails delivery or if lambda fails to process
Copy link
Collaborator

Choose a reason for hiding this comment

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

I had a comment before about making this configurable. could you add a todo maybe if not make it configurable this go around?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Got it, will add a TODO comment

@njmei njmei force-pushed the add-external-sns-trigger-stack branch from be540ae to 5c7a61a Compare July 19, 2024 18:23
@njmei njmei merged commit 12d4970 into main Jul 19, 2024
4 checks passed
@njmei njmei deleted the add-external-sns-trigger-stack branch July 19, 2024 18:24
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