Skip to content

Instantly share code, notes, and snippets.

@hub-cap
Last active December 18, 2015 06:09
Show Gist options
  • Select an option

  • Save hub-cap/5737541 to your computer and use it in GitHub Desktop.

Select an option

Save hub-cap/5737541 to your computer and use it in GitHub Desktop.
HeatTemplateFormatVersion: '2012-12-12'
Description: a test for mysql
Parameters:
KeyName:
Description: Key for the sshing
Type: String
InstanceType:
Description: flavor
Type: String
Default: m1.tiny
AllowedValues: [m1.tiny, m1.small]
ConstraintDescription: must be a valid EC2 instance type.
LinuxDistribution:
Default: precise
Description: Distribution of choice
Type: String
AllowedValues: [precise]
VolumeSize: {Description: Volume size, Type: Number,
Default: '1', MinValue: '1', MaxValue: '100',
ConstraintDescription: must be between 1 and 100 Gb.}
ServiceType: {Type: String, Default: mysql}
InstanceId: {Type: String, Default: NONE}
Mappings:
AWSInstanceType2Arch:
m1.tiny: {Arch: '32'}
m1.small: {Arch: '64'}
DistroArch2AMI:
precise: {'32': precise_ubuntu_image, '64': precise_ubuntu_image}
Resources:
DatabaseInstance:
Type: AWS::EC2::Instance
Metadata:
AWS::CloudFormation::Init:
config:
packages:
apt:
mysql-common: []
files:
/etc/guest_info:
content:
Fn::Join:
- ''
- ["[DEFAULT]\nguest_id=", {Ref: InstanceId},
"\nservice_type=", {Ref: ServiceType}]
mode: '000644'
owner: root
group: root
Properties:
ImageId:
Fn::FindInMap:
- DistroArch2AMI
- {Ref: LinuxDistribution}
- Fn::FindInMap:
- AWSInstanceType2Arch
- {Ref: InstanceType}
- Arch
InstanceType: {Ref: InstanceType}
KeyName: {Ref: KeyName}
UserData:
Fn::Base64:
Fn::Join:
- ''
- ["#!/bin/bash -v\n",
cfn-init]
DataVolume:
Type: AWS::EC2::Volume
Properties:
Size: {Ref: VolumeSize}
AvailabilityZone: nova
Tags:
- {Key: Usage, Value: Test}
MountPoint:
Type: AWS::EC2::VolumeAttachment
Properties:
InstanceId: {Ref: DatabaseInstance}
VolumeId: {Ref: DataVolume}
Device: /dev/vdb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment