Skip to content

Instantly share code, notes, and snippets.

@teh

teh/basic example

Created Feb 17, 2015
Embed
What would you like to do?
let
region = "eu-west-1";
in
{
resources.ec2KeyPairs.waw-pair = { inherit region; };
resources.ec2SecurityGroups.http-ssh = {
inherit region;
rules = [
{ fromPort = 22; toPort = 22; sourceIp = "0.0.0.0/0"; }
{ fromPort = 80; toPort = 80; sourceIp = "0.0.0.0/0"; }
{ fromPort = 443; toPort = 443; sourceIp = "0.0.0.0/0"; }
];
};
webserver = { resources, pkgs, lib, ... }: {
deployment.targetEnv = "ec2";
deployment.ec2.ami = "ami-0126a576";
deployment.ec2.region = region;
deployment.ec2.instanceType = "m3.medium";
deployment.ec2.keyPair = resources.ec2KeyPairs.waw-pair;
deployment.ec2.spotInstancePrice = 2;
deployment.ec2.securityGroups = [ resources.ec2SecurityGroups.http-ssh ];
deployment.ec2.elasticIPv4 = "54.229.92.140";
# Enable a basic firewall
networking.firewall.enable = true;
networking.firewall.allowedTCPPorts = [ 22 80 443 ];
networking.firewall.allowPing = true;
environment.systemPackages = [ pkgs.git ];
# We want to ssh in but keep annoying people out
services.openssh.enable = true;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment