CloudFormation Samples

1371
4
Jump to solution
12-16-2021 01:21 PM
JoeHershman
MVP Regular Contributor

Hi,

Are there any samples of filled in templates for CloudFormation?  Maybe on github or someplace.  I think I have followed the template setup but only part of the parameters load and the rest I need to do manually in the GUI.  It would be really nice to have a working sample to compare to.  Frustrating to need to re-enter parameters every time.  I do not see a way to export after I make the changes on line 

Thanks,
-Joe
0 Kudos
1 Solution

Accepted Solutions
sapnas
by
Occasional Contributor III

You need to add default values for all your parameters. Refer the following aws document

Parameters - AWS CloudFormation (amazon.com)

I have customized parameters to autopopulate my desired values. snippet below

"Parameters": {

........

"ServerLicenseFileKeyName": {
"Type": "String",
"Default": "lic/ArcGISGISServerAdvanced_ArcGISServer.prvc",
"AllowedPattern": "^([/\\w\\-\\.]+)+\\.(ecp|prvc)$",
"ConstraintDescription": "License file name must be alphanumeric. It can contain dash ('-'), dot ('.'), and underscore ('_') characters. The file name must end with '.ecp' or '.prvc'.",
"Description": "Provide the ArcGIS Server authorization file object key name. You must upload the license file ('.ecp' or '.prvc' file) to the deployment bucket before launching this stack. You can get the file object key name by navigating to the file within the deployment bucket in AWS S3 console. For example, 'server.prvc' or 'resources/licenses/109/server/server.prvc'."
},
"SiteadminUserName": {
"Type": "String",
"Default": "myadmin",
"AllowedPattern": "^[a-zA-Z][a-zA-Z0-9_]{6,}$",
"ConstraintDescription": "User name must be 6 or more alphanumeric or underscore (_) characters and must start with a letter.",
"Description": "Provide a user name for the portal administrator and ArcGIS Server site administrator. User name must be 6 or more alphanumeric or underscore (_) characters and must start with a letter.",
"MinLength": 6
},
"SiteadminUserPassword": {
"Type": "String",
"Default": "test",
"AllowedPattern": "^arn:(aws[a-zA-Z-]*)?:secretsmanager:[a-z]{2}((-gov)|(-iso(b?)))?-[a-z]+-\\d{1}:\\d{12}:secret:[a-zA-Z0-9-/_+=.@]*$|^[a-zA-Z0-9_.@]{8,}$",
"ConstraintDescription": "Password must be 8 or more alphanumeric, underscore (_), at ('@'), or dot (.) characters.",
"Description": "Provide a password for the portal administrator and ArcGIS Server site administrator. You can either type a plain text password or the ARN of your secret ID from AWS Secret Manager. The password must be 8 or more alphanumeric characters and can contain underscore (_), at ('@'), or dot (.) characters. It's a best practice to manage your passwords/secrets through AWS Secret Manager.",
"MinLength": 8
},

.....}

View solution in original post

0 Kudos
4 Replies
sapnas
by
Occasional Contributor III

Use optional default parameter  as below 

"Default" : "t2.micro",

0 Kudos
JoeHershman
MVP Regular Contributor

I was looking for a tad more detail.  I thought I could setup the json so when it loads it will populate all the parameters, instead of having to enter through the AWS GUI.  It seems some do populate from my json, but most do not.  Perhaps, I am unlclear on how the template works, but thought to was to simplify repeating the process without having to re-enter things

Thanks,
-Joe
0 Kudos
sapnas
by
Occasional Contributor III

You need to add default values for all your parameters. Refer the following aws document

Parameters - AWS CloudFormation (amazon.com)

I have customized parameters to autopopulate my desired values. snippet below

"Parameters": {

........

"ServerLicenseFileKeyName": {
"Type": "String",
"Default": "lic/ArcGISGISServerAdvanced_ArcGISServer.prvc",
"AllowedPattern": "^([/\\w\\-\\.]+)+\\.(ecp|prvc)$",
"ConstraintDescription": "License file name must be alphanumeric. It can contain dash ('-'), dot ('.'), and underscore ('_') characters. The file name must end with '.ecp' or '.prvc'.",
"Description": "Provide the ArcGIS Server authorization file object key name. You must upload the license file ('.ecp' or '.prvc' file) to the deployment bucket before launching this stack. You can get the file object key name by navigating to the file within the deployment bucket in AWS S3 console. For example, 'server.prvc' or 'resources/licenses/109/server/server.prvc'."
},
"SiteadminUserName": {
"Type": "String",
"Default": "myadmin",
"AllowedPattern": "^[a-zA-Z][a-zA-Z0-9_]{6,}$",
"ConstraintDescription": "User name must be 6 or more alphanumeric or underscore (_) characters and must start with a letter.",
"Description": "Provide a user name for the portal administrator and ArcGIS Server site administrator. User name must be 6 or more alphanumeric or underscore (_) characters and must start with a letter.",
"MinLength": 6
},
"SiteadminUserPassword": {
"Type": "String",
"Default": "test",
"AllowedPattern": "^arn:(aws[a-zA-Z-]*)?:secretsmanager:[a-z]{2}((-gov)|(-iso(b?)))?-[a-z]+-\\d{1}:\\d{12}:secret:[a-zA-Z0-9-/_+=.@]*$|^[a-zA-Z0-9_.@]{8,}$",
"ConstraintDescription": "Password must be 8 or more alphanumeric, underscore (_), at ('@'), or dot (.) characters.",
"Description": "Provide a password for the portal administrator and ArcGIS Server site administrator. You can either type a plain text password or the ARN of your secret ID from AWS Secret Manager. The password must be 8 or more alphanumeric characters and can contain underscore (_), at ('@'), or dot (.) characters. It's a best practice to manage your passwords/secrets through AWS Secret Manager.",
"MinLength": 8
},

.....}

0 Kudos
JoeHershman
MVP Regular Contributor

@sapnas thank you very much.  This is exactly what I needed, everything came in correct.  Seems to me this is buried kind of deep in the file, but guess that is how CloudFormation works.

Thanks,
-Joe
0 Kudos