forked from LifeWay/CloudGenesis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
multi-region-template.yaml
49 lines (43 loc) · 1.74 KB
/
multi-region-template.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#
# If you wish to deploy to multiple regions from a single git repo (verses the alternative of running a git repo per
# region with a CloudGenesis deployed for each of those repos, in their respective region) then you must deploy this
# stack in each region.
#
# This stack will setup the SNS topic for CloudFormation events in each region that the CF events in that region will
# pipe to. CloudFormation does not support cross-region SNS publishing. So this is a "shim" to assist with that process.
#
AWSTemplateFormatVersion: '2010-09-09'
Description: "CloudGenesis: Multi-Region Support Stack"
Parameters:
CloudGenesisStackName:
Description: "The name you gave the CloudGenesis stack"
Type: String
CloudGenesisPrimaryRegion:
Description: "The region the CloudGenesis app is running in"
Type: String
AccountIds:
Description: "The comma delimited list of account ID's that can this instance of CloudGenesis can automatically deploy to."
Type: CommaDelimitedList
Resources:
CloudFormationEventsTopic:
Type: AWS::SNS::Topic
Properties:
TopicName: !Sub "${CloudGenesisStackName}-CloudFormationEventsTopic"
Subscription:
- Endpoint: !Sub "arn:aws:lambda:${CloudGenesisPrimaryRegion}:${AWS::AccountId}:function:${CloudGenesisStackName}-CFEventsNotification"
Protocol: lambda
CloudFormationEventsSNSPolicy:
Type: AWS::SNS::TopicPolicy
Properties:
Topics:
- !Ref CloudFormationEventsTopic
PolicyDocument:
Id: S3TopicPolicy
Version: '2012-10-17'
Statement:
- Sid: "PublishEvents"
Effect: Allow
Principal:
AWS: !Ref AccountIds
Action: sns:Publish
Resource: !Ref CloudFormationEventsTopic