Integrating AWS CloudFormation with Puppet 13
"InstanceType": {
"Default": "m1.small",
"Description" : "Type of EC2 instance for web server",
"Type": "String",
"AllowedValues" : [ "t1.micro", "m1.small", "m1.large", "m1.xlarge", "m2.xlarge", "m2.2xlarge", "m2.4xlarge", "c1.medium", "c1.xlarge",
"cc1.4xlarge" ],
"ConstraintDescription" : "must be a valid EC2 instance type."
},
"DatabaseType": {
"Default": "db.m1.small",
"Description" : "The database instance type",
"Type": "String",
"AllowedValues" : [ "db.m1.small", "db.m1.large", "db.m1.xlarge", "db.m2.xlarge", "db.m2.2xlarge", "db.m2.4xlarge" ],
"ConstraintDescription" : "must be a valid RDS DB Instance type."
},
"DatabaseUser": {
"Default" : "admin",
"NoEcho": "true",
"Type": "String",
"Description" : "Test database admin account name",
"MinLength": "1",
"MaxLength": "16",
"AllowedPattern" : "[a-zA-Z][a-zA-Z0-9]*",
"ConstraintDescription" : "must begin with a letter and contain only alphanumeric characters."
},
"DatabasePassword": {
"Default" : "admin",
"NoEcho": "true",
"Type": "String",
"Description" : "Test database admin account password",
"MinLength": "1",
"MaxLength": "41",
"AllowedPattern" : "[a-zA-Z0-9]*",
"ConstraintDescription" : "must contain only alphanumeric characters."
},
"OperatorEmail": {
"Description": "EMail address to notify if there are operational issues",
"Type": "String"
}
},
"Mappings" : {
"RegionMap" : {
"us-east-1" : { "s3Bucket" : "https://s3.amazonaws.com/cloudformation-templates-us-east-1" },
"us-west-1" : { "s3Bucket" : "https://s3.amazonaws.com/cloudformation-templates-us-west-1" },
"eu-west-1" : { "s3Bucket" : "https://s3.amazonaws.com/cloudformation-templates-eu-west-1" },
"ap-northeast-1" : { "s3Bucket" : "https://s3.amazonaws.com/cloudformation-templates-ap-northeast-1" },
"ap-southeast-1" : { "s3Bucket" : "https://s3.amazonaws.com/cloudformation-templates-ap-southeast-1" }
}
},
"Resources" : {
"AlarmTopic" : {
"Type" : "AWS::SNS::Topic",
"Properties" : {
"Subscription" : [ { "Endpoint" : { "Ref": "OperatorEmail" }, "Protocol" : "email" } ]
}
},
"EC2SecurityGroup" : {
"Type" : "AWS::EC2::SecurityGroup",
"Properties" : {
"GroupDescription" : "Open up SSH and HTTP access",
"SecurityGroupIngress" : [
{"IpProtocol": "tcp", "FromPort": "22", "ToPort": "22", "CidrIp": "0.0.0.0/0" },
{"IpProtocol": "tcp", "FromPort": "80", "ToPort": "80", "CidrIp": "0.0.0.0/0" }
]
}
},
"WebServer" : {
"Type" : "AWS::CloudFormation::Stack",
"Metadata" : {
"Puppet" : {
"roles" : [ "wordpress" ],
"host" : { "Fn::GetAtt" : [ "AppDatabase", "Outputs.DBAddress" ] },
"database" : "WordPressDB",
"user" : {"Ref" : "DatabaseUser"},
"password" : {"Ref" : "DatabasePassword" }
}
},
"Properties" : {
"TemplateURL" : { "Fn::Join" : ["/", [{ "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "s3Bucket" ]},
"puppet-client-configuration.template" ]]},
"Parameters" : {
"KeyName" : { "Ref" : "KeyName" },
"InstanceType" : { "Ref" : "InstanceType"},
"EC2SecurityGroup" : { "Ref" : "EC2SecurityGroup" },
"PuppetClientSecurityGroup" : { "Ref" : "PuppetClientSecurityGroup" },
"PuppetMasterDNSName" : { "Ref" : "PuppetMasterDNSName" },
"StackNameOrId" : { "Ref" : "AWS::StackName" },