Skip to content

Instantly share code, notes, and snippets.

@dguerri
Created July 31, 2013 13:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dguerri/6121871 to your computer and use it in GitHub Desktop.
Save dguerri/6121871 to your computer and use it in GitHub Desktop.
Unifi 3 Beta on UniCloud with OpenStack Heat - AWS Template
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "AWS CloudFormation template for Unifi beta 3.",
"Parameters": {
"KeyName": {
"Type": "String",
"Description": "Name of an existing EC2 KeyPair to enable SSH access to the instances"
},
"InstanceType": {
"Description": "WebServer EC2 instance type",
"Type": "String",
"AllowedValues": [
"01C-.5R-020S",
"01C-01R-040S",
"01C-02R-080S",
"02C-04R-080S",
"02C-02R-080S",
"02C-04R-160S",
"02C-08R-240S",
"04C-08R-320S",
"06C-16R-500S",
"06C-24R-300S"
],
"Default": "01C-01R-040S",
"ConstraintDescription": "must be a valid EC2 instance type."
},
"LinuxDistribution": {
"Description": "Distribution of choice",
"Type": "String",
"AllowedValues": [
"U12"
],
"Default": "U12"
}
},
"Mappings": {
"DistroArch2AMI": {
"U12": {
"64": "U12.04.2-x86_64-cfntools"
}
},
"AWSInstanceType2Arch": {
"06C-16R-500S": {
"Arch": "64"
},
"01C-.5R-020S": {
"Arch": "64"
},
"01C-02R-080S": {
"Arch": "64"
},
"02C-04R-160S": {
"Arch": "64"
},
"02C-02R-080S": {
"Arch": "64"
},
"06C-24R-300S": {
"Arch": "64"
},
"04C-08R-320S": {
"Arch": "64"
},
"02C-08R-240S": {
"Arch": "64"
},
"02C-04R-080S": {
"Arch": "64"
},
"01C-01R-040S": {
"Arch": "64"
}
}
},
"Resources": {
"Unifi3BetaController": {
"Metadata": {
"AWS::CloudFormation::Init": {
"config": {
"files": {
"/etc/apt/sources.list.d/ubiquiti2.list": {
"group": "root",
"content": {
"Fn::Join": [
"",
[
"deb http://www.ubnt.com/downloads/unifi/distros/deb/ubuntu ubuntu ubiquiti\n"
]
]
},
"owner": "root",
"mode": "000644"
}
}
}
}
},
"Type": "AWS::EC2::Instance",
"Properties": {
"InstanceType": {
"Ref": "InstanceType"
},
"KeyName": {
"Ref": "KeyName"
},
"UserData": {
"Fn::Base64": {
"Fn::Join": [
"",
[
"#!/bin/bash -v\n",
"echo 'deb http://www.ubnt.com/downloads/unifi/distros/deb/ubuntu ubuntu ubiquiti' > /etc/apt/sources.list.d/ubiquiti.list\n",
"apt-key adv --keyserver keyserver.ubuntu.com --recv C0A52C50\n",
"apt-get -y update\n",
"apt-get -y install unifi-beta\n"
]
]
}
},
"ImageId": {
"Fn::FindInMap": [
"DistroArch2AMI",
{
"Ref": "LinuxDistribution"
},
{
"Fn::FindInMap": [
"AWSInstanceType2Arch",
{
"Ref": "InstanceType"
},
"Arch"
]
}
]
}
}
},
"FrontendGroup": {
"Type": "AWS::EC2::SecurityGroup",
"Properties": {
"GroupDescription": "Enable HTTPs access via port 8443 plus SSH access",
"SecurityGroupIngress": [
{
"CidrIp": "0.0.0.0/0",
"FromPort": "8443",
"ToPort": "8443",
"IpProtocol": "tcp"
},
{
"CidrIp": "0.0.0.0/0",
"FromPort": "22",
"ToPort": "22",
"IpProtocol": "tcp"
}
]
}
}
},
"Outputs": {
"WebsiteURL": {
"Value": {
"Fn::Join": [
"",
[
"http://",
{
"Fn::GetAtt": [
"WebServer",
"PublicIp"
]
},
":8443/"
]
]
},
"Description": "URL for Unifi"
}
}
}
@dguerri
Copy link
Author

dguerri commented Jul 31, 2013

BTW: File definition at https://gist.github.com/dguerri/6121871#file-unifi3beta-template-L81 just doesn't work...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment