Last active
August 29, 2015 14:17
-
-
Save sgykfjsm/33bb85bc03110e973dea to your computer and use it in GitHub Desktop.
BeanstalkでカスタムAMIを使ったDocker環境を構築するCloudFormationテンプレート
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": "ApparelCloud MediaAPI Template on elastic beanstalk for Non-VPC", | |
"Parameters": { | |
"ApplicationName": { | |
"Description": "Beanstalk Application Name", | |
"Type": "String" | |
}, | |
"BeanstalkInstanceType": { | |
"AllowedValues": [ | |
"t2.micro", | |
"t2.small", | |
"t2.medium", | |
"m3.medium", | |
"m3.large", | |
"m3.xlarge", | |
"m3.2xlarge", | |
"c3.large", | |
"c3.xlarge", | |
"c3.2xlarge", | |
"c3.4xlarge", | |
"c3.8xlarge", | |
"r3.large", | |
"r3.xlarge", | |
"r3.2xlarge", | |
"r3.4xlarge", | |
"r3.8xlarge" | |
], | |
"ConstraintDescription": "must be a valid EC2 instance type.", | |
"Description": "Bastion Host EC2 instance type", | |
"Type": "String" | |
}, | |
"BeanstalkSecurityGroup": { | |
"Description": "Security Group Id for BeanstalkInstace", | |
"Type": "String" | |
}, | |
"CustomAmiId": { | |
"Description": "You can override the default Amazon Machine Image (AMI) by specifying your own custom AMI ID.", | |
"Type": "String" | |
}, | |
"CNAMEPrefix": { | |
"Description": "Endpoint prefix for environment", | |
"Type": "String" | |
}, | |
"EnvironmentName": { | |
"Description": "Environment Name on This Application", | |
"Type": "String" | |
}, | |
"HostName": { | |
"Description": "The URL name for bastion instance", | |
"Type": "String" | |
}, | |
"HostedZone": { | |
"Description": "The DNS name of an existing Amazon Route 53 hosted zone", | |
"Type": "String" | |
}, | |
"KeyName": { | |
"AllowedPattern": "[\\x20-\\x7E]*", | |
"ConstraintDescription": "can contain only ASCII characters.", | |
"Description": "Name of an existing EC2 KeyPair to enable SSH access to the Elastic Beanstalk hosts", | |
"MaxLength": "255", | |
"MinLength": "1", | |
"Type": "String" | |
}, | |
"PrivateSubnet": { | |
"Description": "logical private subnet id existing vpc", | |
"Type": "String" | |
}, | |
"SSHSecurityGroup": { | |
"Description": "Bastion Security Group Id", | |
"Type": "String" | |
}, | |
"SolutionStackName": { | |
"Description": "Application Platform(http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/concepts.platforms.html)", | |
"Type": "String" | |
}, | |
"VPC": { | |
"Description": "logical VPC id", | |
"Type": "String" | |
}, | |
"VPCDefaultSecurityGroup": { | |
"Description": "VPC Default Security Group Id", | |
"Type": "String" | |
} | |
}, | |
"Resources": { | |
"SampleDocker2Environment": { | |
"Properties": { | |
"ApplicationName": { | |
"Ref": "ApplicationName" | |
}, | |
"CNAMEPrefix": { | |
"Ref": "CNAMEPrefix" | |
}, | |
"Description": "", | |
"EnvironmentName": { | |
"Ref": "EnvironmentName" | |
}, | |
"OptionSettings": [ | |
{ | |
"Namespace": "aws:ec2:vpc", | |
"OptionName": "AssociatePublicIpAddress", | |
"Value": "true" | |
}, | |
{ | |
"Namespace": "aws:autoscaling:launchconfiguration", | |
"OptionName": "ImageId", | |
"Value": {"Ref": "CustomAmiId"} | |
}, | |
{ | |
"Namespace": "aws:elasticbeanstalk:environment", | |
"OptionName": "EnvironmentType", | |
"Value": "SingleInstance" | |
}, | |
{ | |
"Namespace": "aws:autoscaling:launchconfiguration", | |
"OptionName": "SSHSourceRestriction", | |
"Value": { | |
"Fn::Join": [ | |
"", | |
[ | |
"tcp,22,22,", | |
{ | |
"Ref": "SSHSecurityGroup" | |
} | |
] | |
] | |
} | |
}, | |
{ | |
"Namespace": "aws:autoscaling:launchconfiguration", | |
"OptionName": "IamInstanceProfile", | |
"Value": "aws-elasticbeanstalk-ec2-role" | |
}, | |
{ | |
"Namespace": "aws:autoscaling:launchconfiguration", | |
"OptionName": "SecurityGroups", | |
"Value": { | |
"Ref": "BeanstalkSecurityGroup" | |
} | |
}, | |
{ | |
"Namespace": "aws:autoscaling:launchconfiguration", | |
"OptionName": "SecurityGroups", | |
"Value": { | |
"Ref": "VPCDefaultSecurityGroup" | |
} | |
}, | |
{ | |
"Namespace": "aws:autoscaling:launchconfiguration", | |
"OptionName": "EC2KeyName", | |
"Value": { | |
"Ref": "KeyName" | |
} | |
}, | |
{ | |
"Namespace": "aws:autoscaling:launchconfiguration", | |
"OptionName": "InstanceType", | |
"Value": { | |
"Ref": "BeanstalkInstanceType" | |
} | |
}, | |
{ | |
"Namespace": "aws:ec2:vpc", | |
"OptionName": "VPCId", | |
"Value": { | |
"Ref": "VPC" | |
} | |
}, | |
{ | |
"Namespace": "aws:ec2:vpc", | |
"OptionName": "Subnets", | |
"Value": { | |
"Ref": "PrivateSubnet" | |
} | |
} | |
], | |
"SolutionStackName": { | |
"Ref": "SolutionStackName" | |
}, | |
"Tier": { | |
"Name": "WebServer", | |
"Type": "Standard", | |
"Version": "1.0" | |
} | |
}, | |
"Type": "AWS::ElasticBeanstalk::Environment" | |
}, | |
"SampleDocker2InstanceDNSRecord": { | |
"Properties": { | |
"Comment": "A record for ac-media instance.", | |
"HostedZoneName": { | |
"Fn::Join": [ | |
"", | |
[ | |
{ | |
"Ref": "HostedZone" | |
}, | |
"." | |
] | |
] | |
}, | |
"Name": { | |
"Fn::Join": [ | |
"", | |
[ | |
{ | |
"Ref": "HostName" | |
}, | |
".", | |
{ | |
"Ref": "HostedZone" | |
}, | |
"." | |
] | |
] | |
}, | |
"ResourceRecords": [ | |
{ | |
"Fn::Join": [ | |
"", | |
[ | |
{ | |
"Ref": "CNAMEPrefix" | |
}, | |
".", | |
"elasticbeanstalk.com", | |
"." | |
] | |
] | |
} | |
], | |
"TTL": "300", | |
"Type": "CNAME" | |
}, | |
"Type": "AWS::Route53::RecordSet" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment