forked from aws-samples/retail-demo-store
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.yaml
298 lines (268 loc) · 11.9 KB
/
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
---
AWSTemplateFormatVersion: 2010-09-09
Description: >
This template deploys the Retail Demo Store reference architecture and workshop notebooks.
Metadata:
AWS::CloudFormation::Interface:
ParameterGroups:
- Label:
default: "Retail Demo Store Deployment Configuration"
Parameters:
- ResourceBucket
- ResourceBucketRelativePath
- CreateElasticsearchServiceLinkedRole
- Label:
default: "Source Deployment Approach"
Parameters:
- SourceDeploymentType
- Label:
default: "GitHub Linked Deployment (only required for GitHub deployment approach)"
Parameters:
- GitHubRepo
- GitHubBranch
- GitHubToken
- GitHubUser
- Label:
default: "Auto-Build Resources"
Parameters:
- PreIndexElasticsearch
- PreCreatePersonalizeCampaign
- Label:
default: "Miscellaneous"
Parameters:
- AmplitudeApiKey
ParameterLabels:
ResourceBucket:
default: "Deployment Resources Staging Bucket Name"
ResourceBucketRelativePath:
default: "Deployment Resources Staging Bucket Relative Path (optional)"
CreateElasticsearchServiceLinkedRole:
default: "Create Elasticsearch Service Role?"
SourceDeploymentType:
default: "Deployment Type"
GitHubRepo:
default: "GitHub Repository Name"
GitHubBranch:
default: "GitHub Branch"
GitHubToken:
default: "GitHub Personal Access Token"
GitHubUser:
default: "GitHub Username"
PreIndexElasticsearch:
default: "Auto-Load Elasticsearch Index"
PreCreatePersonalizeCampaign:
default: "Auto-Build Personalize Campaigns"
AmplitudeApiKey:
default: "Amplitude API Key"
Parameters:
ResourceBucket:
Type: String
Description: >
S3 bucket name where the Retail Demo Store deployment resources are staged (product images, nested CloudFormation templates, source code snapshot,
notebooks, deployment Lambda code, etc).
ResourceBucketRelativePath:
Type: String
Description: >
Optional path in the Deployment Resources Staging bucket where the deployment resources are stored (e.g. path/path2/).
Leave blank if resources are at the root of the Staging Resource Bucket. If specified, MUST end with '/'.
CreateElasticsearchServiceLinkedRole:
Type: String
Description: >
If your account already has an IAM Role named 'AWSServiceRoleForAmazonElasticsearchService', select 'No'. Otherwise, select 'Yes' and one will be created automatically.
AllowedValues:
- 'Yes'
- 'No'
Default: 'Yes'
SourceDeploymentType:
Type: String
Description: >
The Retail Demo Store deployment includes a CodePipeline configuration that will build and deploy Retail Demo Store
microservices to ECS when a change is detected in the source repository. The source repository for CodePipeline
can be configured to use your personal GitHub repository or CodeCommit. Use GitHub if you're actively developing
against Retail Demo Store in your own fork. CodeCommit is useful when you just want to get up and going quickly for
a demo or evaluation or for workshop scenarios, such as Event Engine, where you want attendees to have their own
source repositories provisioned.
AllowedValues:
- 'GitHub'
- 'CodeCommit'
Default: 'CodeCommit'
GitHubRepo:
Type: String
Description: Name of Retail Demo Store GitHub repository in your GitHub account.
Default: retail-demo-store
GitHubBranch:
Type: String
Description: Name of GitHub branch to link to this Retail Demo Store deployment.
Default: master
GitHubToken:
Type: String
Description: GitHub Personal Access Token for your GitHub account. Be sure that your token has the "repo", "repo:status", and "admin:repo_hook" permission scopes.
NoEcho: true
GitHubUser:
Type: String
Description: Your GitHub username.
PreIndexElasticsearch:
Type: String
Description: >
Deploy Lambda function that automatically indexes the Retail Demo Store products in Elasticsearch. Otherwise, select 'No' if you would
prefer to complete this process yourself by stepping through the Search workshop included in your deployment as a Jupyter notebook in SageMaker.
AllowedValues:
- 'Yes'
- 'No'
Default: 'No'
PreCreatePersonalizeCampaign:
Type: String
Description: >
Deploy Lambda function that automatically builds solutions and launches Personalize campaigns. Otherwise, select 'No' if you would
prefer to complete this process yourself by stepping through the Personalization workshop included in your deployment as a Jupyter notebook
in SageMaker.
AllowedValues:
- 'Yes'
- 'No'
Default: 'No'
AmplitudeApiKey:
Type: String
Description: Amplitude API key for integrated product analytics and A/B testing results (optional).
NoEcho: true
Resources:
# Base Resources
Base:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: !Sub https://s3.amazonaws.com/${ResourceBucket}/${ResourceBucketRelativePath}cloudformation-templates/base/_template.yaml
Parameters:
ResourceBucket: !Ref ResourceBucket
ResourceBucketRelativePath: !Ref ResourceBucketRelativePath
SourceDeploymentType: !Ref SourceDeploymentType
CreateElasticsearchServiceLinkedRole: !Ref CreateElasticsearchServiceLinkedRole
CleanupBucketLambdaArn: !GetAtt CleanupBucket.Outputs.LambdaFunctionArn
AmplitudeApiKey: !Ref AmplitudeApiKey
# Services Resources
Services:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: !Sub https://s3.amazonaws.com/${ResourceBucket}/${ResourceBucketRelativePath}cloudformation-templates/services/_template.yaml
Parameters:
ResourceBucket: !Ref ResourceBucket
ResourceBucketRelativePath: !Ref ResourceBucketRelativePath
SourceDeploymentType: !Ref SourceDeploymentType
GitHubRepo: !Ref GitHubRepo
GitHubBranch: !Ref GitHubBranch
GitHubToken: !Ref GitHubToken
GitHubUser: !Ref GitHubUser
UserPoolId: !GetAtt Base.Outputs.UserPoolId
UserPoolClientId: !GetAtt Base.Outputs.UserPoolClientId
IdentityPoolId: !GetAtt Base.Outputs.IdentityPoolId
StackBucketName: !GetAtt Base.Outputs.StackBucketName
Subnets: !GetAtt Base.Outputs.Subnets
VpcId: !GetAtt Base.Outputs.VpcId
ClusterName: !GetAtt Base.Outputs.ClusterName
ServiceDiscoveryNamespace: !GetAtt Base.Outputs.ServiceDiscoveryNamespace
EnvElasticsearchDomainEndpoint: !GetAtt Base.Outputs.ElasticsearchDomainEndpoint
PinpointAppId: !GetAtt Base.Outputs.PinpointAppId
ProductsTable: !GetAtt Base.Outputs.ProductsTable
CategoriesTable: !GetAtt Base.Outputs.CategoriesTable
ExperimentStrategyTable: !GetAtt Base.Outputs.ExperimentStrategyTable
ParameterPersonalizeEventTrackerId: !GetAtt Base.Outputs.ParameterPersonalizeEventTrackerId
ParameterAmplitudeApiKey: !GetAtt Base.Outputs.ParameterAmplitudeApiKey
CleanupBucketLambdaArn: !GetAtt CleanupBucket.Outputs.LambdaFunctionArn
WebRootUrl: !GetAtt Base.Outputs.WebUICDNURL
ImageRootUrl: !Sub
- '${RootURL}/images/'
- RootURL: !GetAtt Base.Outputs.WebUICDNURL
# Web UI Pipeline
WebUIPipeline:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: !Sub https://s3.amazonaws.com/${ResourceBucket}/${ResourceBucketRelativePath}cloudformation-templates/web-ui-pipeline.yaml
Parameters:
ResourceBucket: !Ref ResourceBucket
ResourceBucketRelativePath: !Ref ResourceBucketRelativePath
SourceDeploymentType: !Ref SourceDeploymentType
GitHubRepo: !Ref GitHubRepo
GitHubBranch: !Ref GitHubBranch
GitHubToken: !Ref GitHubToken
GitHubUser: !Ref GitHubUser
UserPoolId: !GetAtt Base.Outputs.UserPoolId
UserPoolClientId: !GetAtt Base.Outputs.UserPoolClientId
IdentityPoolId: !GetAtt Base.Outputs.IdentityPoolId
ProductsServiceExternalUrl: !GetAtt Services.Outputs.ProductsServiceUrl
UsersServiceExternalUrl: !GetAtt Services.Outputs.UsersServiceUrl
CartsServiceExternalUrl: !GetAtt Services.Outputs.CartsServiceUrl
OrdersServiceExternalUrl: !GetAtt Services.Outputs.OrdersServiceUrl
RecommendationsServiceExternalUrl: !GetAtt Services.Outputs.RecommendationsServiceUrl
SearchServiceExternalUrl: !GetAtt Services.Outputs.SearchServiceUrl
PinpointAppId: !GetAtt Base.Outputs.PinpointAppId
ParameterPersonalizeEventTrackerId: !GetAtt Base.Outputs.ParameterPersonalizeEventTrackerId
ParameterAmplitudeApiKey: !GetAtt Base.Outputs.ParameterAmplitudeApiKey
CleanupBucketLambdaArn: !GetAtt CleanupBucket.Outputs.LambdaFunctionArn
WebUICDN: !GetAtt Base.Outputs.WebUICDN
WebUIBucketName: !GetAtt Base.Outputs.WebUIBucketName
WebRootUrl: !GetAtt Base.Outputs.WebUICDNURL
ImageRootUrl: !Sub
- '${RootURL}/images/'
- RootURL: !GetAtt Base.Outputs.WebUICDNURL
# Lex personalization function
ChatbotFunctions:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: !Sub https://s3.amazonaws.com/${ResourceBucket}/${ResourceBucketRelativePath}cloudformation-templates/lex.yaml
Parameters:
ResourceBucket: !Ref ResourceBucket
ResourceBucketRelativePath: !Ref ResourceBucketRelativePath
UsersServiceExternalUrl: !GetAtt Services.Outputs.UsersServiceUrl
RecommendationsServiceExternalUrl: !GetAtt Services.Outputs.RecommendationsServiceUrl
# Deployment support
DeploymentSupport:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: !Sub https://s3.amazonaws.com/${ResourceBucket}/${ResourceBucketRelativePath}cloudformation-templates/deployment-support.yaml
Parameters:
ResourceBucket: !Ref ResourceBucket
ResourceBucketRelativePath: !Ref ResourceBucketRelativePath
PreIndexElasticsearch: !Ref PreIndexElasticsearch
PreCreatePersonalizeCampaign: !Ref PreCreatePersonalizeCampaign
Subnet1: !GetAtt Base.Outputs.Subnet1
Subnet2: !GetAtt Base.Outputs.Subnet2
ElasticsearchSecurityGroupId: !GetAtt Base.Outputs.ElasticsearchSecurityGroupId
ElasticsearchDomainArn: !GetAtt Base.Outputs.ElasticsearchDomainArn
ElasticsearchDomainEndpoint: !GetAtt Base.Outputs.ElasticsearchDomainEndpoint
# Cleanup bucket function
CleanupBucket:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: !Sub https://s3.amazonaws.com/${ResourceBucket}/${ResourceBucketRelativePath}cloudformation-templates/cleanup-bucket.yaml
Outputs:
UserPoolId:
Description: Authentication Cognito User Pool Id.
Value: !GetAtt Base.Outputs.UserPoolId
UserPoolClientId:
Description: Authentication Cognito User Pool Client Id.
Value: !GetAtt Base.Outputs.UserPoolClientId
IdentityPoolId:
Description: Authentication Cognito Identity Pool Id.
Value: !GetAtt Base.Outputs.IdentityPoolId
BucketStackBucketName:
Description: Stack Bucket Name
Value: !GetAtt Base.Outputs.StackBucketName
NotebookInstanceId:
Description: Notebook Instance Id.
Value: !GetAtt Base.Outputs.NotebookInstanceId
VpcId:
Description: VPC Id.
Value: !GetAtt Base.Outputs.VpcId
Subnets:
Description: Service Subnets.
Value: !GetAtt Base.Outputs.Subnets
ClusterName:
Description: ECS Cluster Name.
Value: !GetAtt Base.Outputs.ClusterName
WebURL:
Description: Retail Demo Store Web UI URL
Value: !GetAtt Base.Outputs.WebUICDNURL
ElasticsearchDomainEndpoint:
Description: Elasticsearch Endpoint
Value: !GetAtt Base.Outputs.ElasticsearchDomainEndpoint
PinpointAppId:
Description: Pinpoint App Id.
Value: !GetAtt Base.Outputs.PinpointAppId