Skip to content

Commit 60f0004

Browse files
committed
Updated nested template urls to use s3 virtual hosting. Added a condition for govcloud. Removed AWSInfoRegionMap. Removed unused parameters, added documentation feedback. Moved password file creation from user-data to cfn-init.
1 parent 204ce2b commit 60f0004

File tree

3 files changed

+196
-376
lines changed

3 files changed

+196
-376
lines changed

templates/mongodb-database.template

Lines changed: 73 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,15 @@
4545
"default": "AWS Quick Start Configuration"
4646
},
4747
"Parameters": [
48-
"BuildBucket"
48+
"QSS3BucketName",
49+
"QSS3KeyPrefix"
4950
]
5051
}
5152
],
5253
"ParameterLabels": {
5354
"BastionSecurityGroupID": {
5455
"default": "Bastion Security Group ID"
5556
},
56-
"BuildBucket": {
57-
"default": "Build Bucket"
58-
},
5957
"ClusterReplicaSetCount": {
6058
"default": "Cluster Replica Set Count"
6159
},
@@ -80,6 +78,12 @@
8078
"PrimaryNodeSubnet": {
8179
"default": "Primary Node Subnet"
8280
},
81+
"QSS3BucketName": {
82+
"default": "Quick Start S3 Bucket Name"
83+
},
84+
"QSS3KeyPrefix": {
85+
"default": "Quick Start S3 Key Prefix"
86+
},
8387
"ReplicaShardIndex": {
8488
"default": "Replica Shard Index"
8589
},
@@ -146,10 +150,19 @@
146150
"Type": "String",
147151
"Default": "0"
148152
},
149-
"BuildBucket": {
150-
"Description": "Main Bucket where the templates/scripts are installed. Do not change.",
153+
"QSS3BucketName": {
154+
"AllowedPattern": "^[0-9a-zA-Z]+([0-9a-zA-Z-]*[0-9a-zA-Z])*$",
155+
"Default": "quickstart-reference",
156+
"Type": "String",
157+
"ConstraintDescription": "Quick Start bucket name can include numbers, lowercase letters, uppercase letters, and hyphens (-). It cannot start or end with a hyphen (-).",
158+
"Description": "S3 bucket name for the Quick Start assets. Quick Start bucket name can include numbers, lowercase letters, uppercase letters, and hyphens (-). It cannot start or end with a hyphen (-)."
159+
},
160+
"QSS3KeyPrefix": {
161+
"AllowedPattern": "^[0-9a-zA-Z-/]*$",
162+
"Default": "mongodb/latest/",
151163
"Type": "String",
152-
"Default": "quickstart-reference/mongodb/latest"
164+
"ConstraintDescription": "Quick Start key prefix can include numbers, lowercase letters, uppercase letters, hyphens (-), and forward slash (/).",
165+
"Description": "S3 key prefix for the Quick Start assets. Quick Start key prefix can include numbers, lowercase letters, uppercase letters, hyphens (-), and forward slash (/). It cannot start or end with a hyphen (-)."
153166
},
154167
"KeyPairName": {
155168
"Type": "AWS::EC2::KeyPair::KeyName",
@@ -233,6 +246,14 @@
233246
},
234247
"3"
235248
]
249+
},
250+
"GovCloudCondition": {
251+
"Fn::Equals": [
252+
{
253+
"Ref": "AWS::Region"
254+
},
255+
"us-gov-west-1"
256+
]
236257
}
237258
},
238259
"Mappings": {
@@ -282,68 +303,6 @@
282303
"us-west-2": {
283304
"AMZNLINUX": "ami-4836a428"
284305
}
285-
},
286-
"AWSInfoRegionMap": {
287-
"ap-northeast-1": {
288-
"Partition": "aws",
289-
"QuickStartS3URL": "https://s3.amazonaws.com"
290-
},
291-
"ap-northeast-2": {
292-
"Partition": "aws",
293-
"QuickStartS3URL": "https://s3.amazonaws.com"
294-
},
295-
"ap-south-1": {
296-
"Partition": "aws",
297-
"QuickStartS3URL": "https://s3.amazonaws.com"
298-
},
299-
"ap-southeast-1": {
300-
"Partition": "aws",
301-
"QuickStartS3URL": "https://s3.amazonaws.com"
302-
},
303-
"ap-southeast-2": {
304-
"Partition": "aws",
305-
"QuickStartS3URL": "https://s3.amazonaws.com"
306-
},
307-
"ca-central-1": {
308-
"Partition": "aws",
309-
"QuickStartS3URL": "https://s3.amazonaws.com"
310-
},
311-
"eu-central-1": {
312-
"Partition": "aws",
313-
"QuickStartS3URL": "https://s3.amazonaws.com"
314-
},
315-
"eu-west-1": {
316-
"Partition": "aws",
317-
"QuickStartS3URL": "https://s3.amazonaws.com"
318-
},
319-
"eu-west-2": {
320-
"Partition": "aws",
321-
"QuickStartS3URL": "https://s3.amazonaws.com"
322-
},
323-
"sa-east-1": {
324-
"Partition": "aws",
325-
"QuickStartS3URL": "https://s3.amazonaws.com"
326-
},
327-
"us-east-1": {
328-
"Partition": "aws",
329-
"QuickStartS3URL": "https://s3.amazonaws.com"
330-
},
331-
"us-east-2": {
332-
"Partition": "aws",
333-
"QuickStartS3URL": "https://s3.amazonaws.com"
334-
},
335-
"us-gov-west-1": {
336-
"Partition": "aws-us-gov",
337-
"QuickStartS3URL": "https://s3-us-gov-west-1.amazonaws.com"
338-
},
339-
"us-west-1": {
340-
"Partition": "aws",
341-
"QuickStartS3URL": "https://s3.amazonaws.com"
342-
},
343-
"us-west-2": {
344-
"Partition": "aws",
345-
"QuickStartS3URL": "https://s3.amazonaws.com"
346-
}
347306
}
348307
},
349308
"Resources": {
@@ -507,28 +466,25 @@
507466
"Type": "AWS::CloudFormation::Stack",
508467
"Properties": {
509468
"TemplateURL": {
510-
"Fn::Join": [
511-
"/",
512-
[
513-
{
514-
"Fn::FindInMap": [
515-
"AWSInfoRegionMap",
516-
{
517-
"Ref": "AWS::Region"
518-
},
519-
"QuickStartS3URL"
469+
"Fn::Sub": [
470+
"https://${QSS3BucketName}.${QSS3Region}.amazonaws.com/${QSS3KeyPrefix}templates/mongodb-node.template",
471+
{
472+
"QSS3Region": {
473+
"Fn::If": [
474+
"GovCloudCondition",
475+
"s3-us-gov-west-1",
476+
"s3"
520477
]
521-
},
522-
{
523-
"Ref": "BuildBucket"
524-
},
525-
"templates/mongodb-node.template"
526-
]
478+
}
479+
}
527480
]
528481
},
529482
"Parameters": {
530-
"BuildBucket": {
531-
"Ref": "BuildBucket"
483+
"QSS3BucketName": {
484+
"Ref": "QSS3BucketName"
485+
},
486+
"QSS3KeyPrefix": {
487+
"Ref": "QSS3KeyPrefix"
532488
},
533489
"ClusterReplicaSetCount": {
534490
"Ref": "ClusterReplicaSetCount"
@@ -616,28 +572,25 @@
616572
"Type": "AWS::CloudFormation::Stack",
617573
"Properties": {
618574
"TemplateURL": {
619-
"Fn::Join": [
620-
"/",
621-
[
622-
{
623-
"Fn::FindInMap": [
624-
"AWSInfoRegionMap",
625-
{
626-
"Ref": "AWS::Region"
627-
},
628-
"QuickStartS3URL"
575+
"Fn::Sub": [
576+
"https://${QSS3BucketName}.${QSS3Region}.amazonaws.com/${QSS3KeyPrefix}templates/mongodb-node.template",
577+
{
578+
"QSS3Region": {
579+
"Fn::If": [
580+
"GovCloudCondition",
581+
"s3-us-gov-west-1",
582+
"s3"
629583
]
630-
},
631-
{
632-
"Ref": "BuildBucket"
633-
},
634-
"templates/mongodb-node.template"
635-
]
584+
}
585+
}
636586
]
637587
},
638588
"Parameters": {
639-
"BuildBucket": {
640-
"Ref": "BuildBucket"
589+
"QSS3BucketName": {
590+
"Ref": "QSS3BucketName"
591+
},
592+
"QSS3KeyPrefix": {
593+
"Ref": "QSS3KeyPrefix"
641594
},
642595
"ClusterReplicaSetCount": {
643596
"Ref": "ClusterReplicaSetCount"
@@ -726,28 +679,25 @@
726679
"Type": "AWS::CloudFormation::Stack",
727680
"Properties": {
728681
"TemplateURL": {
729-
"Fn::Join": [
730-
"/",
731-
[
732-
{
733-
"Fn::FindInMap": [
734-
"AWSInfoRegionMap",
735-
{
736-
"Ref": "AWS::Region"
737-
},
738-
"QuickStartS3URL"
682+
"Fn::Sub": [
683+
"https://${QSS3BucketName}.${QSS3Region}.amazonaws.com/${QSS3KeyPrefix}templates/mongodb-node.template",
684+
{
685+
"QSS3Region": {
686+
"Fn::If": [
687+
"GovCloudCondition",
688+
"s3-us-gov-west-1",
689+
"s3"
739690
]
740-
},
741-
{
742-
"Ref": "BuildBucket"
743-
},
744-
"templates/mongodb-node.template"
745-
]
691+
}
692+
}
746693
]
747694
},
748695
"Parameters": {
749-
"BuildBucket": {
750-
"Ref": "BuildBucket"
696+
"QSS3BucketName": {
697+
"Ref": "QSS3BucketName"
698+
},
699+
"QSS3KeyPrefix": {
700+
"Ref": "QSS3KeyPrefix"
751701
},
752702
"ClusterReplicaSetCount": {
753703
"Ref": "ClusterReplicaSetCount"

0 commit comments

Comments
 (0)