CloudFormation template for a self-healing Kestrel stack.
This is a work-in-progress and does not currently include service discovery or persistence. But if you don't care about those things, this template should suit you fine.
This template bootstraps a Kestrel stack.
The stack runs a single server within an auto-scaling group. If the server is terminated, the auto-scaling group will launch a replacement.
The template creates a security group for Kestrel clients, the id for which is exposed as an output (ClientSecurityGroup
).
Note that this template must be used with Amazon VPC. New AWS accounts automatically use VPC, but if you have an old account and are still using EC2-Classic, you'll need to modify this template or make the switch.
git clone [email protected]:thefactory/cloudformation-kestrel.git
This is a VPC security group containing access rules for Kestrel administration, and should be locked down to your IP range, a bastion host, or similar. This security group will be associated with the Kestrel server.
Inbound rules are at your discretion, but you may want to include access to:
22 [tcp]
- SSH port2222 [tcp]
- text listen port2223 [tcp]
- admin HTTP port2229 [tcp]
- thrift listen port22133 [tcp]
- memcache listen port
Launch the stack via the AWS console, a script, or aws-cli.
See kestrel.json
for the full list of parameters, descriptions, and default values.
Example using aws-cli
:
aws cloudformation create-stack \
--template-body file://kestrel.json \
--stack-name <stack> \
--capabilities CAPABILITY_IAM \
--parameters \
ParameterKey=KeyName,ParameterValue=<key> \
ParameterKey=VpcId,ParameterValue=<vpc_id> \
ParameterKey=Subnets,ParameterValue='<subnet_id_1>\,<subnet_id_2>' \
ParameterKey=AdminSecurityGroup,ParameterValue=<sg_id>
Once the stack has been provisioned, try hitting the Kestrel admin interface at http://<host>:2223/
. You will need to do this from a location granted access by the specified AdminSecurityGroup
.
You should see a Kestrel-generated page:
$ curl localhost:2223
<html>
<head>
ostrich
</head>
<body>
<p>
Might be cool to have something interesting here someday. For now: Hello!
</p>
</body>
</html>
Once you associate ClientSecurityGroup
with your clients, you'll be able to start using Kestrel.