Skip to content

Instantly share code, notes, and snippets.

@tkuchiki
Last active August 29, 2015 14:06
Show Gist options
  • Save tkuchiki/13fb80b1982254acfbe1 to your computer and use it in GitHub Desktop.
Save tkuchiki/13fb80b1982254acfbe1 to your computer and use it in GitHub Desktop.
EC2 の DHCP Option Sets (consul 用)

dhcp option sets 作成

$ aws ec2 create-dhcp-options --dhcp-configuration file://dhcp.json
{
    "DhcpOptions": {
        "DhcpConfigurations": [
            {
                "Values": [
                    "node.consul service.consul ap-northeast-1.compute.internal"
                ],
                "Key": "domain-name"
            },
            {
                "Values": [
                    "127.0.0.1",
                    "10.x.0.2"
                ],
                "Key": "domain-name-servers"
            }
        ],
        "DhcpOptionsId": "dopt-xxxxxxxx"
    }
}

VPC に associate

$ aws ec2 associate-dhcp-options --dhcp-options-id dopt-xxxxxxxx --vpc-id vpc-yyyyyyyy
{
    "return": "true"
}
[
{
"Values": [
"node.consul service.consul ap-northeast-1.compute.internal"
],
"Key": "domain-name"
},
{
"Values": [
"127.0.0.1",
"10.x.0.2" // show /etc/resolv.conf
],
"Key": "domain-name-servers"
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment