Skip to content

Instantly share code, notes, and snippets.

@thepoppingone
Last active November 5, 2020 15:26
Show Gist options
  • Save thepoppingone/95cae80b7ebf18fc3128bc079c98c3bc to your computer and use it in GitHub Desktop.
Save thepoppingone/95cae80b7ebf18fc3128bc079c98c3bc to your computer and use it in GitHub Desktop.
eks launch template
resource "aws_launch_template" "your_eks_launch_template" {
name = "your_eks_launch_template"
vpc_security_group_ids = [var.your_security_group.id, aws_eks_cluster.your-eks-cluster.vpc_config[0].cluster_security_group_id]
block_device_mappings {
device_name = "/dev/xvda"
ebs {
volume_size = 20
volume_type = "gp2"
}
}
image_id = "your_ami_value"
instance_type = "t3.medium"
user_data = base64encode(<<-EOF
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="==MYBOUNDARY=="
--==MYBOUNDARY==
Content-Type: text/x-shellscript; charset="us-ascii"
#!/bin/bash
/etc/eks/bootstrap.sh your-eks-cluster
--==MYBOUNDARY==--\
EOF
)
tag_specifications {
resource_type = "instance"
tags = {
Name = "EKS-MANAGED-NODE"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment