File tree Expand file tree Collapse file tree 4 files changed +314
-85
lines changed Expand file tree Collapse file tree 4 files changed +314
-85
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,15 @@ Resources:
79
79
Topic :
80
80
Ref : Notifications
81
81
82
+ SNSTopicWithSQSSubscription :
83
+ Type : SNS
84
+ Properties :
85
+ Topic :
86
+ Ref : Notifications
87
+ SqsSubscription :
88
+ QueueArn : !GetAtt Queue.Arn
89
+ QueueUrl : !Ref Queue
90
+
82
91
KinesisStream :
83
92
Type : Kinesis
84
93
Properties :
@@ -99,3 +108,7 @@ Resources:
99
108
100
109
Images :
101
110
Type : AWS::S3::Bucket
111
+
112
+ Queue :
113
+ Condition : MyCondition
114
+ Type : AWS::SQS::Queue
Original file line number Diff line number Diff line change 222
222
"ManagedPolicyArns" : [
223
223
" arn:aws-cn:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ,
224
224
" arn:aws-cn:iam::aws:policy/service-role/AWSLambdaKinesisExecutionRole" ,
225
- " arn:aws-cn:iam::aws:policy/service-role/AWSLambdaDynamoDBExecutionRole"
225
+ " arn:aws-cn:iam::aws:policy/service-role/AWSLambdaDynamoDBExecutionRole" ,
226
+ " arn:aws-cn:iam::aws:policy/service-role/AWSLambdaSQSQueueExecutionRole"
226
227
],
227
228
"Tags" : [
228
229
{
459
460
"DependsOn" : [
460
461
" FunctionOneImageBucketPermission"
461
462
]
463
+ },
464
+ "MyAwesomeFunctionSNSTopicWithSQSSubscription" : {
465
+ "Type" : " AWS::SNS::Subscription" ,
466
+ "Properties" : {
467
+ "Endpoint" : {
468
+ "Fn::GetAtt" : [
469
+ " Queue" ,
470
+ " Arn"
471
+ ]
472
+ },
473
+ "Protocol" : " sqs" ,
474
+ "TopicArn" : {
475
+ "Ref" : " Notifications"
476
+ }
477
+ },
478
+ "Condition" : " MyCondition"
479
+ },
480
+ "MyAwesomeFunctionSNSTopicWithSQSSubscriptionQueuePolicy" : {
481
+ "Type" : " AWS::SQS::QueuePolicy" ,
482
+ "Properties" : {
483
+ "Queues" : [
484
+ {
485
+ "Ref" : " Queue"
486
+ }
487
+ ],
488
+ "PolicyDocument" : {
489
+ "Version" : " 2012-10-17" ,
490
+ "Statement" : [
491
+ {
492
+ "Action" : " sqs:SendMessage" ,
493
+ "Resource" : {
494
+ "Fn::GetAtt" : [
495
+ " Queue" ,
496
+ " Arn"
497
+ ]
498
+ },
499
+ "Effect" : " Allow" ,
500
+ "Condition" : {
501
+ "ArnEquals" : {
502
+ "aws:SourceArn" : {
503
+ "Ref" : " Notifications"
504
+ }
505
+ }
506
+ },
507
+ "Principal" : " *"
508
+ }
509
+ ]
510
+ }
511
+ },
512
+ "Condition" : " MyCondition"
513
+ },
514
+ "MyAwesomeFunctionSNSTopicWithSQSSubscriptionEventSourceMapping" : {
515
+ "Type" : " AWS::Lambda::EventSourceMapping" ,
516
+ "Properties" : {
517
+ "BatchSize" : 10 ,
518
+ "Enabled" : true ,
519
+ "FunctionName" : {
520
+ "Ref" : " MyAwesomeFunctionAliasLive"
521
+ },
522
+ "EventSourceArn" : {
523
+ "Fn::GetAtt" : [
524
+ " Queue" ,
525
+ " Arn"
526
+ ]
527
+ }
528
+ },
529
+ "Condition" : " MyCondition"
530
+ },
531
+ "Queue" : {
532
+ "Type" : " AWS::SQS::Queue" ,
533
+ "Condition" : " MyCondition"
462
534
}
463
535
}
464
536
}
Original file line number Diff line number Diff line change 222
222
"ManagedPolicyArns" : [
223
223
" arn:aws-us-gov:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ,
224
224
" arn:aws-us-gov:iam::aws:policy/service-role/AWSLambdaKinesisExecutionRole" ,
225
- " arn:aws-us-gov:iam::aws:policy/service-role/AWSLambdaDynamoDBExecutionRole"
225
+ " arn:aws-us-gov:iam::aws:policy/service-role/AWSLambdaDynamoDBExecutionRole" ,
226
+ " arn:aws-us-gov:iam::aws:policy/service-role/AWSLambdaSQSQueueExecutionRole"
226
227
],
227
228
"Tags" : [
228
229
{
459
460
"DependsOn" : [
460
461
" FunctionOneImageBucketPermission"
461
462
]
463
+ },
464
+ "MyAwesomeFunctionSNSTopicWithSQSSubscription" : {
465
+ "Type" : " AWS::SNS::Subscription" ,
466
+ "Properties" : {
467
+ "Endpoint" : {
468
+ "Fn::GetAtt" : [
469
+ " Queue" ,
470
+ " Arn"
471
+ ]
472
+ },
473
+ "Protocol" : " sqs" ,
474
+ "TopicArn" : {
475
+ "Ref" : " Notifications"
476
+ }
477
+ },
478
+ "Condition" : " MyCondition"
479
+ },
480
+ "MyAwesomeFunctionSNSTopicWithSQSSubscriptionQueuePolicy" : {
481
+ "Type" : " AWS::SQS::QueuePolicy" ,
482
+ "Properties" : {
483
+ "Queues" : [
484
+ {
485
+ "Ref" : " Queue"
486
+ }
487
+ ],
488
+ "PolicyDocument" : {
489
+ "Version" : " 2012-10-17" ,
490
+ "Statement" : [
491
+ {
492
+ "Action" : " sqs:SendMessage" ,
493
+ "Resource" : {
494
+ "Fn::GetAtt" : [
495
+ " Queue" ,
496
+ " Arn"
497
+ ]
498
+ },
499
+ "Effect" : " Allow" ,
500
+ "Condition" : {
501
+ "ArnEquals" : {
502
+ "aws:SourceArn" : {
503
+ "Ref" : " Notifications"
504
+ }
505
+ }
506
+ },
507
+ "Principal" : " *"
508
+ }
509
+ ]
510
+ }
511
+ },
512
+ "Condition" : " MyCondition"
513
+ },
514
+ "MyAwesomeFunctionSNSTopicWithSQSSubscriptionEventSourceMapping" : {
515
+ "Type" : " AWS::Lambda::EventSourceMapping" ,
516
+ "Properties" : {
517
+ "BatchSize" : 10 ,
518
+ "Enabled" : true ,
519
+ "FunctionName" : {
520
+ "Ref" : " MyAwesomeFunctionAliasLive"
521
+ },
522
+ "EventSourceArn" : {
523
+ "Fn::GetAtt" : [
524
+ " Queue" ,
525
+ " Arn"
526
+ ]
527
+ }
528
+ },
529
+ "Condition" : " MyCondition"
530
+ },
531
+ "Queue" : {
532
+ "Type" : " AWS::SQS::Queue" ,
533
+ "Condition" : " MyCondition"
462
534
}
463
535
}
464
536
}
You can’t perform that action at this time.
0 commit comments