Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sns-sqs-cdk/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
aws-cdk-lib==2.13.0
aws-cdk-lib==2.257.0
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

constructs>=10.0.0,<11.0.0
13 changes: 0 additions & 13 deletions sns-sqs-cdk/sns_sqs_cdk/sns_sqs_cdk_stack.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
from aws_cdk import (
Stack,
CfnOutput,
RemovalPolicy,
Duration,
aws_iam as iam,
aws_sns as sns,
aws_sns_subscriptions as snssubs,
aws_sqs as sqs
Expand All @@ -28,16 +25,6 @@ def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
# Add the SQS subscription to the sns topic
MySnsTopic.add_subscription(sqsSubscription)

# Add policy statement to SQS Policy that is created as part of the new queue
iam.PolicyStatement(actions=['SQS:SendMessage'],
effect=iam.Effect.ALLOW,
conditions={'ArnEquals': MySnsTopic.topic_arn},
resources=[MySqsQueue.queue_arn],
principals=[
iam.ServicePrincipal('sns.amazonaws.com')
]
)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

note: add_subscription() automatically adds an equivalent SQS resource policy, so this block is redundant😀

CfnOutput(self, "SQS queue name", description="SQS queue name", value=MySqsQueue.queue_name)
CfnOutput(self, "SQS queue ARN", description="SQS queue arn", value=MySqsQueue.queue_arn)
CfnOutput(self, "SQS queue URL", description="SQS queue URL", value=MySqsQueue.queue_url)
Expand Down