Skip to content

Instantly share code, notes, and snippets.

@sgykfjsm
Created March 14, 2015 15:27
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 sgykfjsm/c250891a3f2ec5b65eee to your computer and use it in GitHub Desktop.
Save sgykfjsm/c250891a3f2ec5b65eee to your computer and use it in GitHub Desktop.
cutstom-ami-mold.template for elastic beanstalk docker in us-west-2
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "custom-ami-mold.template: This template creating a simple instance in a VPC in order to create custom ami image for elastic beanstalk.",
"Mappings": {
"Tags": {
"SSHSecurityGroup": {
"Name": "Mold-SSHSecurityGroup"
}
}
},
"Parameters": {
"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"
},
"MoldAmiId": {
"Description": "You can override the default Amazon Machine Image (AMI) by specifying your own custom AMI ID.",
"Type": "String"
},
"MoldInstanceName": {
"Description": "Tag Value for Instace Name",
"Type": "String"
},
"MoldInstanceType": {
"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": "Mold Host EC2 instance type",
"Type": "String"
},
"PublicSubnet": {
"Description": "logical public subnet id existing vpc",
"Type": "String"
},
"SSHFrom": {
"AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
"ConstraintDescription": "must be a valid CIDR range of the form x.x.x.x/x.",
"Default": "0.0.0.0/0",
"Description": "Lockdown SSH access to the bastion host (default can be accessed from anywhere)",
"MaxLength": "18",
"MinLength": "9",
"Type": "String"
},
"VPC": {
"Description": "logical VPC id",
"Type": "String"
}
},
"Resources": {
"MoldInstance": {
"Properties": {
"ImageId": {
"Ref": "MoldAmiId"
},
"InstanceType": {
"Ref": "MoldInstanceType"
},
"KeyName": {
"Ref": "KeyName"
},
"NetworkInterfaces": [
{
"AssociatePublicIpAddress": "True",
"DeleteOnTermination": "True",
"DeviceIndex": "0",
"GroupSet": [
{
"Ref": "SSHSecurityGroup"
}
],
"SubnetId": {
"Ref": "PublicSubnet"
}
}
],
"Tags": [
{
"Key": "Name",
"Value": {
"Ref": "MoldInstanceName"
}
}
],
"UserData": {
"Fn::Base64": {
"Fn::Join": [
"",
[
"#cloud-config",
"repo_releasever: <repository version number>",
"repo_upgrade: none"
]
]
}
}
},
"Type": "AWS::EC2::Instance"
},
"SSHSecurityGroup": {
"Properties": {
"GroupDescription": "Enable SSH access via port 22",
"SecurityGroupIngress": [
{
"CidrIp": {
"Ref": "SSHFrom"
},
"FromPort": "22",
"IpProtocol": "tcp",
"ToPort": "22"
}
],
"Tags": [
{
"Key": "Name",
"Value": {
"Fn::FindInMap": [
"Tags",
"SSHSecurityGroup",
"Name"
]
}
}
],
"VpcId": {
"Ref": "VPC"
}
},
"Type": "AWS::EC2::SecurityGroup"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment