-
Notifications
You must be signed in to change notification settings - Fork 77
/
template.yaml
1228 lines (1157 loc) · 68.3 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
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: "AWS Marketplace Serverless SaaS Integration Application"
Globals:
Function:
Timeout: 15
Api:
Cors:
AllowMethods: "'POST,OPTIONS'"
AllowHeaders: "'*'"
AllowOrigin: "'*'"
AllowCredentials: "'*'"
Parameters:
WebsiteS3BucketName:
Type: String
#AllowedPattern: "(?!(^xn--|.+-s3alias$))^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$"
ConstraintDescription: "S3 bucket name must follow S3 recommendations https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html"
Default: ""
NewSubscribersTableName:
Type: String
AllowedPattern: ".*"
Default: "AWSMarketplaceSubscribers"
AWSMarketplaceMeteringRecordsTableName:
Type: String
AllowedPattern: ".*"
Default: "AWSMarketplaceMeteringRecords"
TypeOfSaaSListing:
Type: String
Default: contracts_with_subscription
AllowedValues:
- contracts_with_subscription
- contracts
- subscriptions
SNSAccountID:
Type: String
Default: "287250355862"
Description: "This is the AWS account hosting the SNS Entitlement and Subscription topics for your product."
AllowedValues:
- "287250355862"
SNSRegion:
Type: String
Default: "us-east-1"
Description: "This is the AWS region of the SNS Entitlement and Subscription topics for your product."
AllowedValues:
- us-east-1
ProductId:
Type: String
AllowedPattern: ".*"
MarketplaceTechAdminEmail:
Type: String
AllowedPattern: ".*"
MarketplaceSellerEmail:
Type: String
AllowedPattern: ".*"
Default: ""
CreateCrossAccountRole:
Default: "false"
Description: "Do you intend to use cross account access with this integration core?"
Type: String
AllowedValues:
- "true"
- "false"
CrossAccountId:
Default: ''
Description: "Enter the cross AWS account id"
Type: String
CrossAccountRoleName:
Type: String
Description: "Your Role Name (ex: OrganizationAccountAccessRole); This will need to be the same across all of the Member Accounts"
CreateRegistrationWebPage:
Default: "true"
Type: String
AllowedValues:
- "true"
- "false"
UpdateFulfillmentURL:
Default: "false"
Type: String
Description: "WARNING: This will update your product's fulfillment URL automatically. Be careful if your product is already public"
AllowedValues:
- "true"
- "false"
Conditions:
CreateEntitlementLogic:
Fn::Or:
- !Equals [!Ref TypeOfSaaSListing, contracts_with_subscription]
- !Equals [!Ref TypeOfSaaSListing, contracts]
CreateSubscriptionLogic:
Fn::Or:
- !Equals [!Ref TypeOfSaaSListing, contracts_with_subscription]
- !Equals [!Ref TypeOfSaaSListing, subscriptions]
CreateWeb: !Equals [!Ref CreateRegistrationWebPage, true]
Buyernotificationemail: !Not [!Equals [!Ref MarketplaceSellerEmail, ""]]
CreateCrossAccount: !Equals [!Ref CreateCrossAccountRole, true]
UpdateFulfillment: !Equals [!Ref UpdateFulfillmentURL, true]
Resources:
ServerlessApi:
Type: AWS::Serverless::Api
Properties:
StageName: Prod
MethodSettings:
- ResourcePath: /subscriber
HttpMethod: POST, OPTIONS
- ResourcePath: /redirectmarketplacetoken
HttpMethod: POST, OPTIONS
CrossAccountRoleForSaaSIntegration:
Type: AWS::IAM::Role
Condition: CreateCrossAccount
DependsOn:
- AWSMarketplaceMeteringRecords
- AWSMarketplaceSubscribers
Properties:
RoleName:
!Join
- '-'
- - 'CrossAccountRoleName'
- !Select
- 0
- !Split
- "-"
- !Select
- 2
- !Split
- "/"
- !Ref AWS::StackId
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Principal:
AWS:
- !Join [":", ["arn:aws:iam:", !Ref CrossAccountId , "root"]]
Action:
- 'sts:AssumeRole'
Condition:
StringEquals:
'sts:ExternalId': !Ref CrossAccountRoleName
Path: /
Policies:
- PolicyName:
!Join
- '-'
- - 'CrossAccountPolicy'
- !Select
- 0
- !Split
- "-"
- !Select
- 2
- !Split
- "/"
- !Ref AWS::StackId
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Action:
- 'dynamodb:PutItem'
- 'dynamodb:DeleteItem'
- 'dynamodb:UpdateItem'
Resource:
- !GetAtt AWSMarketplaceMeteringRecords.Arn
- !GetAtt AWSMarketplaceSubscribers.Arn
AWSMarketplaceMeteringRecords:
Type: AWS::DynamoDB::Table
Condition: CreateSubscriptionLogic
Properties:
AttributeDefinitions:
- AttributeName: "customerIdentifier"
AttributeType: "S"
- AttributeName: "create_timestamp"
AttributeType: "N"
- AttributeName: "metering_pending"
AttributeType: "S"
BillingMode: PAY_PER_REQUEST
KeySchema:
- AttributeName: "customerIdentifier"
KeyType: "HASH"
- AttributeName: "create_timestamp"
KeyType: "RANGE"
GlobalSecondaryIndexes:
- IndexName: PendingMeteringRecordsIndex
KeySchema:
- AttributeName: "metering_pending"
KeyType: "HASH"
Projection:
ProjectionType: ALL
TableName: !Ref AWSMarketplaceMeteringRecordsTableName
AWSMarketplaceSubscribers:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
- AttributeName: "customerIdentifier"
AttributeType: "S"
BillingMode: PAY_PER_REQUEST
KeySchema:
- AttributeName: "customerIdentifier"
KeyType: "HASH"
TableName: !Ref NewSubscribersTableName
StreamSpecification:
StreamViewType: NEW_AND_OLD_IMAGES
RegisterNewMarketplaceCustomer:
Type: AWS::Serverless::Function
Properties:
CodeUri: src/
Handler: register-new-subscriber.registerNewSubscriber
Runtime: nodejs18.x
Environment:
Variables:
NewSubscribersTableName: !Ref NewSubscribersTableName
EntitlementQueueUrl:
!If [CreateEntitlementLogic, !Ref EntitlementSQSQueue, !Ref AWS::NoValue]
MarketplaceSellerEmail:
!If [Buyernotificationemail, !Ref MarketplaceSellerEmail, !Ref AWS::NoValue]
Policies:
- DynamoDBWritePolicy:
TableName: !Ref NewSubscribersTableName
- Statement:
- Sid: AWSMarketplaceResolveCustomer
Effect: Allow
Action:
- aws-marketplace:ResolveCustomer
Resource: "*"
- !If
- CreateEntitlementLogic
- Statement:
- Sid: SQSPolicy
Effect: Allow
Action:
- sqs:SendMessage
Resource: !GetAtt EntitlementSQSQueue.Arn
- !Ref "AWS::NoValue"
- Statement:
- Sid: Sendemail
Effect: Allow
Action:
- ses:SendEmail
Resource: "*"
Events:
RegisterCustomer:
Type: Api
Properties:
Path: /subscriber
Method: post
RestApiId: !Ref ServerlessApi
EntitlementSQSQueue:
Type: AWS::SQS::Queue
Condition: CreateEntitlementLogic
EntitlementSQSHandler:
Type: AWS::Serverless::Function
Condition: CreateEntitlementLogic
Properties:
CodeUri: src
Handler: entitlement-sqs.handler
Runtime: nodejs18.x
Environment:
Variables:
NewSubscribersTableName: !Ref NewSubscribersTableName
Policies:
- DynamoDBWritePolicy:
TableName: !Ref NewSubscribersTableName
- SQSSendMessagePolicy:
QueueName: !GetAtt EntitlementSQSQueue.Arn
- Statement:
- Sid: AWSMarketplaceEntitlements
Effect: Allow
Action:
- aws-marketplace:GetEntitlements
Resource: "*"
Events:
MySQSEvent:
Type: SNS
Properties:
Topic: !Sub 'arn:aws:sns:${SNSRegion}:${SNSAccountID}:aws-mp-entitlement-notification-${GetProductCode.ProductCode}'
Region: !Sub '${SNSRegion}'
SqsSubscription:
BatchSize: 1
QueueArn: !GetAtt EntitlementSQSQueue.Arn
QueueUrl: !Ref EntitlementSQSQueue
SubscriptionSQSHandler:
Type: AWS::Serverless::Function
Properties:
CodeUri: src
Handler: subscription-sqs.SQSHandler
Runtime: nodejs18.x
Environment:
Variables:
NewSubscribersTableName: !Ref NewSubscribersTableName
SupportSNSArn: !Ref SupportSNSTopic
Policies:
- DynamoDBWritePolicy:
TableName: !Ref NewSubscribersTableName
- Statement:
- Sid: SNSPublish
Effect: Allow
Action:
- sns:Publish
Resource: !Ref SupportSNSTopic
Events:
MySQSEvent:
Type: SNS
Properties:
#Topic: !Ref SubscriptionSNSTopic
Topic: !Sub 'arn:aws:sns:${SNSRegion}:${SNSAccountID}:aws-mp-subscription-notification-${GetProductCode.ProductCode}'
Region: !Sub '${SNSRegion}'
SqsSubscription: true
SupportSNSTopic:
Type: AWS::SNS::Topic
Properties:
Subscription:
- Endpoint: !Ref MarketplaceTechAdminEmail
Protocol: email
GrantOrRevokeAccess:
Type: AWS::Serverless::Function
Properties:
CodeUri: src
Handler: grant-revoke-access-to-product.dynamodbStreamHandler
Runtime: nodejs18.x
Environment:
Variables:
SupportSNSArn: !Ref SupportSNSTopic
LOG_LEVEL: "info"
Policies:
- AWSLambdaDynamoDBExecutionRole
- Statement:
- Sid: SNSPublish
Effect: Allow
Action:
- sns:Publish
Resource: !Ref SupportSNSTopic
Events:
Stream:
Type: DynamoDB
Properties:
Stream: !GetAtt AWSMarketplaceSubscribers.StreamArn
BatchSize: 1
StartingPosition: TRIM_HORIZON
Hourly:
Type: AWS::Serverless::Function
Condition: CreateSubscriptionLogic
Properties:
CodeUri: src
Handler: metering-hourly-job.job
Runtime: nodejs18.x
Environment:
Variables:
SQSMeteringRecordsUrl: !Ref SQSMeteringRecords
AWSMarketplaceMeteringRecordsTableName: !Ref AWSMarketplaceMeteringRecordsTableName
Policies:
- DynamoDBReadPolicy:
TableName: !Ref AWSMarketplaceMeteringRecordsTableName
- SQSSendMessagePolicy:
QueueName: !GetAtt SQSMeteringRecords.QueueName
Events:
CWSchedule:
Type: Schedule
Properties:
Schedule: "rate(1 hour)"
Name:
!Join
- '-'
- - 'MeteringSchedule'
- !Select
- 0
- !Split
- "-"
- !Select
- 2
- !Split
- "/"
- !Ref AWS::StackId
Description: SaaS Metering
Enabled: true
SQSMeteringRecords:
Type: AWS::SQS::Queue
Properties:
QueueName:
!Join
- '-'
- - !Select
- 0
- !Split
- "-"
- !Select
- 2
- !Split
- "/"
- !Ref AWS::StackId
- 'SQSMeteringRecords.fifo'
ContentBasedDeduplication: true
FifoQueue: true
MessageRetentionPeriod: 3000
Condition: CreateSubscriptionLogic
MeteringSQSHandler:
Type: AWS::Serverless::Function
Condition: CreateSubscriptionLogic
Properties:
CodeUri: src
Handler: metering-sqs.handler
Runtime: nodejs18.x
Environment:
Variables:
ProductCode: !GetAtt GetProductCode.ProductCode
AWSMarketplaceMeteringRecordsTableName: !Ref AWSMarketplaceMeteringRecordsTableName
Policies:
- DynamoDBWritePolicy:
TableName: !Ref AWSMarketplaceMeteringRecordsTableName
- Statement:
- Sid: AWSMarketplaceMetering
Effect: Allow
Action:
- aws-marketplace:BatchMeterUsage
Resource: "*"
Events:
MySQSEvent:
Type: SQS
Properties:
Queue: !GetAtt SQSMeteringRecords.Arn
BatchSize: 1
Bucket: !GetAtt WebsiteS3BucketLog.DomainName
IncludeCookies: false
Prefix: "access-logs"
WebsiteS3Bucket:
Type: AWS::S3::Bucket
Condition: CreateWeb
Properties:
BucketName: !Ref WebsiteS3BucketName
WebsiteS3BucketLog:
Type: AWS::S3::Bucket
Condition: CreateWeb
Properties:
BucketName: !Join ["-", [!Ref WebsiteS3BucketName, "log"]]
OwnershipControls:
Rules:
- ObjectOwnership: BucketOwnerPreferred
IntelligentTieringConfigurations:
- Id: !Join ["-", [!Ref WebsiteS3BucketName, "log"]]
Status: Enabled
Tierings:
- AccessTier: ARCHIVE_ACCESS
Days: 90
S3BucketPolicy:
Type: AWS::S3::BucketPolicy
Condition: CreateWeb
Properties:
Bucket: !Ref WebsiteS3Bucket
PolicyDocument:
# Restricting access to cloudfront only.
Statement:
- Effect: Allow
Sid: "AllowCloudFrontServicePrincipal"
Action: "s3:GetObject"
Resource:
- !Sub "arn:aws:s3:::${WebsiteS3Bucket}/*"
Principal:
Service: "cloudfront.amazonaws.com"
Condition:
StringEquals:
"AWS:SourceArn" :
- !Sub "arn:aws:cloudfront::${AWS::AccountId}:distribution/${CloudfrontDistribution}"
LambdaRedirectPostRequests:
Type: AWS::Serverless::Function
Condition: CreateWeb
Properties:
Runtime: nodejs18.x
CodeUri: src/
Handler: redirect.redirecthandler
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: "Allow"
Action: "sts:AssumeRole"
Principal:
Service:
- "lambda.amazonaws.com"
Environment:
Variables:
RedirectUrl: https://aws-ia.github.io/cloudformation-aws-marketplace-saas/#_post_deployment_steps
Events:
RedirectMarketplaceToken:
Type: Api
Properties:
Path: /redirectmarketplacetoken
Method: post
RestApiId: !Ref ServerlessApi
CloudFrontOriginAccessControl:
Type: "AWS::CloudFront::OriginAccessControl"
Properties:
OriginAccessControlConfig:
Description:
!Join
- '-'
- - 'Origin Access Control for static website'
- !Select
- 0
- !Split
- "-"
- !Select
- 2
- !Split
- "/"
- !Ref AWS::StackId
Name:
!Join
- '-'
- - 'OAC'
- !Select
- 0
- !Split
- "-"
- !Select
- 2
- !Split
- "/"
- !Ref AWS::StackId
OriginAccessControlOriginType: "s3"
SigningBehavior: "always"
SigningProtocol: "sigv4"
CloudfrontDistribution:
Type: "AWS::CloudFront::Distribution"
Condition: CreateWeb
DependsOn: ServerlessApi
Properties:
DistributionConfig:
Comment:
!Join
- '-'
- - 'Cloudfront distribution for serverless website'
- !Select
- 0
- !Split
- "-"
- !Select
- 2
- !Split
- "/"
- !Ref AWS::StackId
DefaultRootObject: "index.html"
Enabled: true
HttpVersion: http2
# List of origins that Cloudfront will connect to
Origins:
- Id: s3-website
DomainName: !GetAtt WebsiteS3Bucket.RegionalDomainName
OriginAccessControlId: !Ref CloudFrontOriginAccessControl
S3OriginConfig:
OriginAccessIdentity: ""
- Id: api-gateway
DomainName: !Sub "${ServerlessApi}.execute-api.${AWS::Region}.amazonaws.com"
CustomOriginConfig:
OriginProtocolPolicy: "https-only"
OriginSSLProtocols:
- "TLSv1.2"
HTTPSPort: 443
OriginPath: "/Prod"
# To connect the CDN to the origins you need to specify behaviours
DefaultCacheBehavior:
# Compress resources automatically ( gzip )
Compress: true
AllowedMethods:
- HEAD
- DELETE
- POST
- GET
- OPTIONS
- PUT
- PATCH
ForwardedValues:
QueryString: false
TargetOriginId: s3-website
ViewerProtocolPolicy: redirect-to-https
CacheBehaviors:
- PathPattern: /redirectmarketplacetoken
AllowedMethods:
- HEAD
- DELETE
- POST
- GET
- OPTIONS
- PUT
- PATCH
TargetOriginId: api-gateway
ViewerProtocolPolicy: redirect-to-https
ResponseHeadersPolicyId: 60669652-455b-4ae9-85a4-c4c02393f86c
CachePolicyId: 4135ea2d-6df8-44a3-9df3-4b5a84be39ad
OriginRequestPolicyId: b689b0a8-53d0-40ab-baf2-68738e2966ac
- PathPattern: /subscriber
AllowedMethods:
- HEAD
- DELETE
- POST
- GET
- OPTIONS
- PUT
- PATCH
TargetOriginId: api-gateway
ViewerProtocolPolicy: redirect-to-https
ResponseHeadersPolicyId: 60669652-455b-4ae9-85a4-c4c02393f86c
CachePolicyId: 4135ea2d-6df8-44a3-9df3-4b5a84be39ad
OriginRequestPolicyId: b689b0a8-53d0-40ab-baf2-68738e2966ac
Logging:
Bucket: !GetAtt WebsiteS3BucketLog.DomainName
IncludeCookies: false
Prefix: "access-logs"
S3ContentHome:
Type: Custom::Lambda
Condition: CreateWeb
Properties:
ServiceToken: !GetAtt S3ContentCustomResource.Arn
BucketName: !Ref WebsiteS3Bucket
Key: index.html
ContentType: "text/html"
Body: |
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="style.css">
<title>Registration page</title>
</head>
<body class="text-center">
<div class="container">
<div id="alert"></div>
<form class="form-signin" method="POST" enctype="multipart/form-data">
<img class="mb-4" src="logo.png" alt="" width="72" height="72">
<h1 class="h3 mb-3 font-weight-normal">Please enter your contact details</h1>
<label for="companyName" class="sr-only">Company name</label>
<input type="text" name="companyName" class="form-control" placeholder="Company name" required autofocus>
<label for="contactPerson" class="sr-only">Contact person</label>
<input type="text" name="contactPerson" class="form-control" placeholder="Contact person" required autofocus>
<label for="Contact phone" class="sr-only">Contact phone</label>
<input type="tel" name="contactPhone" class="form-control" placeholder="Contact phone" required autofocus>
<label for="contactEmail" class="sr-only">Email address</label>
<input type="email" name="contactEmail" class="form-control" placeholder="Email address" required autofocus>
<button class="btn btn-lg btn-primary btn-block" type="submit">Register</button>
<p class="mt-5 mb-3 text-muted">© 2024</p>
</form>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.7.0.min.js"
integrity="sha384-NXgwF8Kv9SSAr+jemKKcbvQsz+teULH/a5UNJvZc6kP47hZgl62M1vGnw6gHQhb1"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
crossorigin="anonymous"></script>
<script src="/script.js"></script>
</body>
</html>
S3ContentScript:
Type: Custom::Lambda
Condition: CreateWeb
Properties:
ServiceToken: !GetAtt S3ContentCustomResource.Arn
BucketName: !Ref WebsiteS3Bucket
Key: script.js
ContentType: "text/javascript"
Body: |
const form = document.getElementsByClassName('form-signin')[0];
const showAlert = (cssClass, message) => {
const html = `
<div class="alert alert-${cssClass} alert-dismissible" role="alert">
<strong>${message}</strong>
<button class="close" type="button" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>`;
document.querySelector('#alert').innerHTML += html;
};
const formToJSON = (elements) => [].reduce.call(elements, (data, element) => {
data[element.name] = element.value;
return data;
}, {});
const getUrlParameter = (name) => {
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
const regex = new RegExp(`[\\?&]${name}=([^&#]*)`);
const results = regex.exec(location.search);
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
};
const handleFormSubmit = (event) => {
event.preventDefault();
const postUrl = `/subscriber`;
const regToken = getUrlParameter('x-amzn-marketplace-token');
if (!regToken) {
showAlert('danger',
'Registration Token Missing. Please go to AWS Marketplace and follow the instructions to set up your account!');
} else {
const data = formToJSON(form.elements);
data.regToken = regToken;
const xhr = new XMLHttpRequest();
xhr.open('POST', postUrl, true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.send(JSON.stringify(data));
xhr.onreadystatechange = () => {
if (xhr.readyState == XMLHttpRequest.DONE) {
showAlert('primary', xhr.responseText);
console.log(JSON.stringify(xhr.responseText));
}
};
}
};
form.addEventListener('submit', handleFormSubmit);
const regToken = getUrlParameter('x-amzn-marketplace-token');
if (!regToken) {
showAlert('danger', 'Registration Token Missing. Please go to AWS Marketplace and follow the instructions to set up your account!');
}
S3ContentStyle:
Type: Custom::Lambda
Condition: CreateWeb
Properties:
ServiceToken: !GetAtt S3ContentCustomResource.Arn
BucketName: !Ref WebsiteS3Bucket
Key: style.css
ContentType: "text/css"
Body: |
html,
body {
height: 100%;
}
body {
display: -ms-flexbox;
display: flex;
-ms-flex-align: center;
align-items: center;
padding-top: 40px;
padding-bottom: 40px;
background-color: #f5f5f5;
}
.form-signin {
width: 100%;
max-width: 330px;
padding: 15px;
margin: auto;
}
.form-signin .checkbox {
font-weight: 400;
}
.form-signin .form-control {
position: relative;
box-sizing: border-box;
height: auto;
padding: 10px;
font-size: 16px;
margin-top:5px;
}
.form-signin .form-control:focus {
z-index: 2;
}
.form-signin input[type="email"] {
margin-bottom: -1px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.form-signin input[type="password"] {
margin-bottom: 10px;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.bd-placeholder-img {
font-size: 1.125rem;
text-anchor: middle;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
@media (min-width: 768px) {
.bd-placeholder-img-lg {
font-size: 3.5rem;
}
}
S3ContentLogo:
Type: Custom::Lambda
Condition: CreateWeb
Properties:
ServiceToken: !GetAtt S3ContentCustomResource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B9bkk1vfzV9+oEXIy4uH6q++MsvO/fSS2FeBh6DlQLhBgvprHqwLBJ44f+yhP4lSJJJPDt1tkG7WlLPymI9rAcLFEWczQ4Pdt03N9/x+xJLS8tKysu1tUo7XhQFPaX3DuvbTxUieXv29Mpvs+dekN25XznxPczLMmgP7kkg3ODi3WltEMweZJNEzxJ1Zy9qa1nsKb2zTi/eM3HSpCre178/wk9ddit/rfc2VU+f8qneywRreKe7snke0uAikBnowa021NYVAt0RZP+FC+PGtca+Lwv2Pb6XBfzoeiL14ZKpU69Hy+uujOh74XzwEQiEG3zM+1Jjl1vLooVkEYxHBFBCKkAEAuEKcFC6alKaWIyZjZtFJgPBugIt3A8IBAQCAgGBgEBAICAQEAgIBAQCAgGBgEBAICAQEAgIBAQCAgGBgEBAICAQEAgIBAQCAgGBgEBAICAQEAgIBAQCAgGBgEBAICAQEAgIBAQCAgGBgEBAICAQEAgIBASGCwL/Hz9PaFwMuXydAAAAAElFTkSuQmCC
S3ContentFavicon:
Type: Custom::Lambda
Condition: CreateWeb
Properties:
ServiceToken: !GetAtt S3ContentCustomResource.Arn
BucketName: !Ref WebsiteS3Bucket
Key: favicon.ico
ContentType: "image/x-icon"
IsBase64Encoded: true
Body: AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArmYf/51RE/8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACuZh//rmYf/65mH/+dURP/nVET/51RE/8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACuZh//rmYf/65mH/+uZh//nVET/51RE/+dURP/nVET/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArmYf/65mH/+uZh//rmYf/51RE/+dURP/nVET/51RE/8AAAAAAAAAAAAAAAAA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nAACBgQAAAAAAAAAAAAAAAAAAAAAAAIGBAADn5wAA//8AAA==
# Custom Lambda function that creates an object in specified S3 bucket and prefix
S3ContentCustomResource:
Type: AWS::Lambda::Function
Condition: CreateWeb
DependsOn: S3ContentCustomResourceLogGroup
Properties:
Code:
ZipFile: |
const { S3Client, PutObjectCommand, DeleteObjectCommand } = require("@aws-sdk/client-s3");
const s3Client = new S3Client();
exports.handler = async function(event, context) {
console.log("REQUEST RECEIVED:\n" + JSON.stringify(event));
let responseStatus = "FAILED";
let responseData = {};
let physicalResourceId = event.ResourceProperties.Key;
// For Delete requests, delete object.
if (event.RequestType == "Delete") {
console.log(`Deleting s3://${event.ResourceProperties.BucketName}/${event.ResourceProperties.Key}`);
try {
const deleteObjectCommand = new DeleteObjectCommand({
Bucket: event.ResourceProperties.BucketName,
Key: event.ResourceProperties.Key
});
await s3Client.send(deleteObjectCommand);
responseStatus = "SUCCESS";
console.log("Deleted");
} catch (e) {
console.error(`Failed to delete object: ${e.message}`);
}
} else {
const body = typeof event.ResourceProperties.IsBase64Encoded == "string" && event.ResourceProperties.IsBase64Encoded.toLowerCase() == "true" ? Buffer.from(event.ResourceProperties.Body, 'base64') : event.ResourceProperties.Body;
console.log(`Saving s3://${event.ResourceProperties.BucketName}/${event.ResourceProperties.Key}`);
try {
const putObjectCommand = new PutObjectCommand({
Body: body,
Bucket: event.ResourceProperties.BucketName,
Key: event.ResourceProperties.Key,
ContentType: event.ResourceProperties.ContentType
});
await s3Client.send(putObjectCommand);
console.log("Saved");
responseData["BucketName"] = event.ResourceProperties.BucketName;
responseData["Key"] = event.ResourceProperties.Key;
responseData["ContentType"] = event.ResourceProperties.ContentType;
responseStatus = "SUCCESS";
} catch (e) {
console.log(`Could not save to S3: ${e.message}`);
}
}
return await sendResponse(event, context, responseStatus, responseData, physicalResourceId);
};
// Send response to the pre-signed S3 URL
const sendResponse = async function(event, context, responseStatus, responseData, physicalResourceId) {
let responseBody = JSON.stringify({
Status: responseStatus,
Reason: "See the details in CloudWatch Log Stream: " + context.logStreamName,
PhysicalResourceId: physicalResourceId,
StackId: event.StackId,
RequestId: event.RequestId,
LogicalResourceId: event.LogicalResourceId,
Data: responseData
});
console.log("RESPONSE BODY:\n", responseBody);
await sendRequest(event.ResponseURL, {
method: "PUT",
body: responseBody
})
};
// Web request
const sendRequest = async function(url, opt) {
opt = opt ? opt : {};
const parsedUrl = require("url").parse(url);
let headers = opt.headers ? opt.headers : {};
headers["Content-length"] = opt.body ? opt.body.length : 0;
const options = {
hostname: parsedUrl.hostname,
port: opt.port ? opt.port : (parsedUrl.protocol == "https:" ? 443 : 80),
path: parsedUrl.path,
method: opt.method ? opt.method : "GET",
headers: headers
};
let response = await new Promise(function(res, err) {
let request = require(parsedUrl.protocol == "https:" ? "https" : "http").request(options, function(response) {
let responseText = [];
response.on("data", function(d) {
responseText.push(d);
});
response.on("end", function() {
response.responseText = responseText.join("");
res(response);
});
});
request.on("error", function(error) {
console.error("sendRequest Error: " + error);
err(error);
});
request.write(opt.body ? opt.body : "");
request.end();
});
return response;
};
FunctionName: !Sub
- "S3ContentCustomResource-${id}"
- id: !Select
- 0
- !Split
- "-"
- !Select
- 2
- !Split
- "/"
- !Ref AWS::StackId
Handler: index.handler
Role: !GetAtt S3ContentCustomResourceRole.Arn
Runtime: nodejs20.x
# Role for custom Lambda function to log activity and put/delete objects in S3 bucket created in this template
S3ContentCustomResourceRole:
Type: AWS::IAM::Role
Condition: CreateWeb
Properties:
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
Action:
- "sts:AssumeRole"
Policies:
- PolicyName: LambdaExecute
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Action:
- "logs:CreateLogStream"
- "logs:PutLogEvents"
Resource:
- !Sub
- "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/S3ContentCustomResource-${id}*"
- id: !Select
- 0
- !Split
- "-"
- !Select
- 2
- !Split
- "/"
- !Ref AWS::StackId
- Effect: Allow