Last active
March 19, 2019 10:12
-
-
Save kagarlickij/7aec042affb09656c6e5a1b74913a249 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"AWSTemplateFormatVersion": "2010-09-09", | |
"Description": "AWS QuickStart Template for Tableau Server instance running on Windows QS(0040)", | |
"Parameters": { | |
"ContentAdminPassword": { | |
"Description": "The password for the initial Admin user for Tableau server", | |
"MinLength": "1", | |
"NoEcho": "true", | |
"Type": "String" | |
}, | |
"ContentAdminUser": { | |
"Default": "admin", | |
"Description": "The name of the initial Admin user for Tableau server", | |
"MinLength": "1", | |
"Type": "String" | |
}, | |
"KeyPairName": { | |
"ConstraintDescription": "The name of an existing EC2 KeyPair.", | |
"Description": "Public/private key pairs allow you to securely connect to your instance after it launches", | |
"Type": "AWS::EC2::KeyPair::KeyName" | |
}, | |
"RegCity": { | |
"Type": "String" | |
}, | |
"RegCompany": { | |
"Type": "String" | |
}, | |
"RegCountry": { | |
"Type": "String" | |
}, | |
"RegDepartment": { | |
"Type": "String" | |
}, | |
"RegEmail": { | |
"MinLength": "1", | |
"Type": "String" | |
}, | |
"RegFirstName": { | |
"MinLength": "1", | |
"Type": "String" | |
}, | |
"RegIndustry": { | |
"Type": "String" | |
}, | |
"RegLastName": { | |
"MinLength": "1", | |
"Type": "String" | |
}, | |
"RegPhone": { | |
"Type": "String" | |
}, | |
"RegState": { | |
"Type": "String" | |
}, | |
"RegTitle": { | |
"Type": "String" | |
}, | |
"RegZip": { | |
"Type": "String" | |
}, | |
"ResourceAvailabilityZone": { | |
"Description": "The availability zone in which our server and storage volume reside", | |
"Type": "AWS::EC2::AvailabilityZone::Name" | |
}, | |
"SourceCIDR": { | |
"AllowedPattern": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\\/([0-9]|[1-2][0-9]|3[0-2]))$", | |
"ConstraintDescription": "CIDR block parameter must be in the form x.x.x.x/x", | |
"Description": "The CIDR address from which you will connect to the instance", | |
"Type": "String" | |
}, | |
"TableauServerLicenseKey": { | |
"Description": "License Key (leave blank for trial)", | |
"Type": "String" | |
} | |
}, | |
"Metadata": { | |
"AWS::CloudFormation::Interface": { | |
"ParameterGroups": [ | |
{ | |
"Label": { | |
"default": "AWS Environment" | |
}, | |
"Parameters": [ | |
"KeyPairName", | |
"ResourceAvailabilityZone", | |
"SourceCIDR" | |
] | |
}, | |
{ | |
"Label": { | |
"default": "Configure Initial Tableau Admin User" | |
}, | |
"Parameters": [ | |
"ContentAdminUser", | |
"ContentAdminPassword" | |
] | |
}, | |
{ | |
"Label": { | |
"default": "Registration" | |
}, | |
"Parameters": [ | |
"TableauServerLicenseKey", | |
"RegFirstName", | |
"RegLastName", | |
"RegEmail", | |
"RegCompany", | |
"RegTitle", | |
"RegDepartment", | |
"RegIndustry", | |
"RegPhone", | |
"RegCity", | |
"RegState", | |
"RegZip", | |
"RegCountry" | |
] | |
} | |
], | |
"ParameterLabels": { | |
"KeyPairName": { | |
"default": "Key Pair Name" | |
}, | |
"ResourceAvailabilityZone": { | |
"default": "Target Availability Zone" | |
}, | |
"SourceCIDR": { | |
"default": "Source CIDR for Access" | |
}, | |
"ContentAdminUser": { | |
"default": "Portal Admin Username" | |
}, | |
"ContentAdminPassword": { | |
"default": "Portal Admin Password" | |
}, | |
"TableauServerLicenseKey": { | |
"default": "Tableau Activation Key" | |
}, | |
"RegFirstName": { | |
"default": "First Name" | |
}, | |
"RegLastName": { | |
"default": "Last Name" | |
}, | |
"RegEmail": { | |
"default": "Email Address" | |
}, | |
"RegCompany": { | |
"default": "Company" | |
}, | |
"RegTitle": { | |
"default": "Title" | |
}, | |
"RegDepartment": { | |
"default": "Department" | |
}, | |
"RegIndustry": { | |
"default": "Industry" | |
}, | |
"RegPhone": { | |
"default": "Phone" | |
}, | |
"RegCity": { | |
"default": "City" | |
}, | |
"RegState": { | |
"default": "State" | |
}, | |
"RegZip": { | |
"default": "Zip/Postal Code" | |
}, | |
"RegCountry": { | |
"default": "Country" | |
} | |
} | |
} | |
}, | |
"Mappings": { | |
"AWSAMIRegionMap": { | |
"AMI": { | |
"WS2012R2": "Windows_Server-2012-R2_RTM-English-64Bit-Base-2017.04.12" | |
}, | |
"ap-northeast-1": { | |
"WS2012R2": "ami-51c8e036" | |
}, | |
"ap-northeast-2": { | |
"WS2012R2": "ami-06528068" | |
}, | |
"ap-south-1": { | |
"WS2012R2": "ami-3d0e7c52" | |
}, | |
"ap-southeast-1": { | |
"WS2012R2": "ami-a843fbcb" | |
}, | |
"ap-southeast-2": { | |
"WS2012R2": "ami-72525a11" | |
}, | |
"ca-central-1": { | |
"WS2012R2": "ami-53c37f37" | |
}, | |
"eu-central-1": { | |
"WS2012R2": "ami-8f6fb2e0" | |
}, | |
"eu-west-1": { | |
"WS2012R2": "ami-58a1a73e" | |
}, | |
"eu-west-2": { | |
"WS2012R2": "ami-22feea46" | |
}, | |
"sa-east-1": { | |
"WS2012R2": "ami-64afc208" | |
}, | |
"us-east-1": { | |
"WS2012R2": "ami-e659c7f0" | |
}, | |
"us-east-2": { | |
"WS2012R2": "ami-b5785fd0" | |
}, | |
"us-west-1": { | |
"WS2012R2": "ami-ccf2d6ac" | |
}, | |
"us-west-2": { | |
"WS2012R2": "ami-2ad04f4a" | |
} | |
}, | |
"DefaultConfiguration": { | |
"InstallationConfig": { | |
"InstallationBucket": "tableau-quickstart", | |
"InstallationExecutable": "Setup-Server-x64.exe" | |
}, | |
"MachineConfiguration": { | |
"InstanceType": "m4.4xlarge", | |
"SystemVolumeSize": 50, | |
"DataVolumeSize": 100, | |
"WindowsVersion": "WS2012R2" | |
} | |
} | |
}, | |
"Conditions": { | |
"IsTrial": { | |
"Fn::Equals": [ | |
"", | |
{ | |
"Ref": "TableauServerLicenseKey" | |
} | |
] | |
} | |
}, | |
"Resources": { | |
"InstanceSecurityGroup": { | |
"Type": "AWS::EC2::SecurityGroup", | |
"Properties": { | |
"GroupDescription": "Enable RDP", | |
"SecurityGroupIngress": [ | |
{ | |
"IpProtocol": "tcp", | |
"FromPort": "3389", | |
"ToPort": "3389", | |
"CidrIp": { | |
"Ref": "SourceCIDR" | |
} | |
}, | |
{ | |
"IpProtocol": "tcp", | |
"FromPort": "80", | |
"ToPort": "80", | |
"CidrIp": { | |
"Ref": "SourceCIDR" | |
} | |
} | |
] | |
} | |
}, | |
"TableauWindowsServer": { | |
"Type": "AWS::EC2::Instance", | |
"DependsOn": [ | |
"InstanceSecurityGroup" | |
], | |
"Metadata": { | |
"AWS::CloudFormation::Init": { | |
"config": { | |
"files": { | |
"c:\\tabsetup\\secrets.json": { | |
"content": { | |
"content_admin_user": { | |
"Ref": "ContentAdminUser" | |
}, | |
"content_admin_pass": { | |
"Ref": "ContentAdminPassword" | |
} | |
} | |
}, | |
"c:\\tabsetup\\registration.json": { | |
"content": { | |
"first_name": { | |
"Ref": "RegFirstName" | |
}, | |
"last_name": { | |
"Ref": "RegLastName" | |
}, | |
"email": { | |
"Ref": "RegEmail" | |
}, | |
"company": { | |
"Fn::Join": [ | |
";", | |
[ | |
{ | |
"Ref": "RegCompany" | |
}, | |
"AWSQuickStart" | |
] | |
] | |
}, | |
"title": { | |
"Ref": "RegTitle" | |
}, | |
"department": { | |
"Ref": "RegDepartment" | |
}, | |
"industry": { | |
"Ref": "RegIndustry" | |
}, | |
"phone": { | |
"Ref": "RegPhone" | |
}, | |
"city": { | |
"Ref": "RegCity" | |
}, | |
"state": { | |
"Ref": "RegState" | |
}, | |
"zip": { | |
"Ref": "RegZip" | |
}, | |
"country": { | |
"Ref": "RegCountry" | |
} | |
} | |
}, | |
"c:\\tabsetup\\ScriptedInstaller.py": { | |
"source": { | |
"Fn::Join": [ | |
"", | |
[ | |
"https://", | |
{ | |
"Fn::FindInMap": [ | |
"DefaultConfiguration", | |
"InstallationConfig", | |
"InstallationBucket" | |
] | |
}, | |
".s3.amazonaws.com/ScriptedInstaller.py" | |
] | |
] | |
} | |
}, | |
"c:\\tabsetup\\python-2.7.12.msi": { | |
"source": "https://www.python.org/ftp/python/2.7.12/python-2.7.12.msi" | |
}, | |
"c:\\tabsetup\\tableau-server-installer.exe": { | |
"source": { | |
"Fn::Join": [ | |
"", | |
[ | |
"https://", | |
{ | |
"Fn::FindInMap": [ | |
"DefaultConfiguration", | |
"InstallationConfig", | |
"InstallationBucket" | |
] | |
}, | |
".s3.amazonaws.com/", | |
{ | |
"Fn::FindInMap": [ | |
"DefaultConfiguration", | |
"InstallationConfig", | |
"InstallationExecutable" | |
] | |
} | |
] | |
] | |
} | |
} | |
}, | |
"commands": { | |
"1-install-python": { | |
"command": "c:\\tabsetup\\python-2.7.12.msi /quiet /qn", | |
"cwd": "c:\\tabsetup", | |
"waitAfterCompletion": "0" | |
}, | |
"2-pip-install-yaml": { | |
"command": "c:\\Python27\\Scripts\\pip.exe install pyyaml", | |
"cwd": "c:\\Python27\\Scripts", | |
"waitAfterCompletion": "0" | |
}, | |
"3-run-installer": { | |
"cwd": "c:\\tabsetup", | |
"command": { | |
"Fn::Join": [ | |
" ", | |
[ | |
"c:\\Python27\\python.exe", | |
"ScriptedInstaller.py", | |
"install", | |
"--installerLog", | |
"C:\\tabsetup\\tabinstall.txt", | |
"--enablePublicFwRule", | |
"--secretsFile c:\\tabsetup\\secrets.json", | |
"--registrationFile c:\\tabsetup\\registration.json", | |
"--installDir d:\\tableau", | |
{ | |
"Fn::If": [ | |
"IsTrial", | |
"--trialLicense", | |
{ | |
"Fn::Sub": "--licenseKey ${TableauServerLicenseKey}" | |
} | |
] | |
}, | |
"c:\\tabsetup\\tableau-server-installer.exe", | |
" > c:\\tabsetup\\installer-output.txt 2>&1" | |
] | |
] | |
}, | |
"waitAfterCompletion": "0" | |
}, | |
"4-cleanup-secrets": { | |
"cwd": "c:\\tabsetup", | |
"command": "del c:\\tabsetup\\secrets.json", | |
"waitAfterCompletion": "0" | |
} | |
} | |
} | |
} | |
}, | |
"Properties": { | |
"InstanceType": { | |
"Fn::FindInMap": [ | |
"DefaultConfiguration", | |
"MachineConfiguration", | |
"InstanceType" | |
] | |
}, | |
"ImageId": { | |
"Fn::FindInMap": [ | |
"AWSAMIRegionMap", | |
{ | |
"Ref": "AWS::Region" | |
}, | |
{ | |
"Fn::FindInMap": [ | |
"DefaultConfiguration", | |
"MachineConfiguration", | |
"WindowsVersion" | |
] | |
} | |
] | |
}, | |
"AvailabilityZone": { | |
"Ref": "ResourceAvailabilityZone" | |
}, | |
"BlockDeviceMappings": [ | |
{ | |
"DeviceName": "/dev/sda1", | |
"Ebs": { | |
"VolumeSize": { | |
"Fn::FindInMap": [ | |
"DefaultConfiguration", | |
"MachineConfiguration", | |
"SystemVolumeSize" | |
] | |
}, | |
"VolumeType": "gp2" | |
} | |
}, | |
{ | |
"DeviceName": "xvdc", | |
"Ebs": { | |
"VolumeSize": { | |
"Fn::FindInMap": [ | |
"DefaultConfiguration", | |
"MachineConfiguration", | |
"DataVolumeSize" | |
] | |
}, | |
"VolumeType": "gp2" | |
} | |
} | |
], | |
"SecurityGroups": [ | |
{ | |
"Ref": "InstanceSecurityGroup" | |
} | |
], | |
"KeyName": { | |
"Ref": "KeyPairName" | |
}, | |
"UserData": { | |
"Fn::Base64": { | |
"Fn::Join": [ | |
"\n", | |
[ | |
"<script>", | |
{ | |
"Fn::Sub": "cfn-init.exe -v -s ${AWS::StackId} -r TableauWindowsServer --region ${AWS::Region}" | |
}, | |
{ | |
"Fn::Sub": [ | |
"cfn-signal.exe -e %errorlevel% ${WHUrl}", | |
{ | |
"WHUrl": { | |
"Fn::Base64": { | |
"Ref": "TableauServerWaitHandle" | |
} | |
} | |
} | |
] | |
}, | |
"</script>" | |
] | |
] | |
} | |
}, | |
"Tags": [ | |
{ | |
"Key": "Name", | |
"Value": { | |
"Fn::Sub": "${AWS::StackName}-cfn-tableau-server" | |
} | |
} | |
] | |
} | |
}, | |
"TableauServerWaitHandle": { | |
"Type": "AWS::CloudFormation::WaitConditionHandle" | |
}, | |
"TableauServerWaitCondition": { | |
"Type": "AWS::CloudFormation::WaitCondition", | |
"Properties": { | |
"Handle": { | |
"Ref": "TableauServerWaitHandle" | |
}, | |
"Timeout": "3600" | |
} | |
} | |
}, | |
"Outputs": { | |
"InstanceID": { | |
"Description": "EC2 InstanceID of the instance running Tableau Server", | |
"Value": { | |
"Ref": "TableauWindowsServer" | |
} | |
}, | |
"PublicIPAddress": { | |
"Description": "Public IP Address of instance running Tableau Server", | |
"Value": { | |
"Fn::GetAtt": [ | |
"TableauWindowsServer", | |
"PublicIp" | |
] | |
} | |
}, | |
"PublicDNSName": { | |
"Description": "Public DNS name of instance running Tableau Server", | |
"Value": { | |
"Fn::GetAtt": [ | |
"TableauWindowsServer", | |
"PublicDnsName" | |
] | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment