This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This data source is included for ease of sample architecture deployment | |
# and can be swapped out as necessary. | |
data "aws_availability_zones" "available" { | |
} | |
resource "aws_vpc" "demo" { | |
cidr_block = "10.0.0.0/16" | |
tags = { | |
"Name" = "terraform-eks-demo-node" | |
"kubernetes.io/cluster/${var.cluster-name}" = "shared" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_iam_role" "demo-node" { | |
name = "terraform-eks-demo-cluster" | |
assume_role_policy = <<POLICY | |
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Principal": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_security_group" "demo-cluster" { | |
name = "terraform-eks-demo-cluster" | |
description = "Cluster communication with worker nodes" | |
vpc_id = "${aws_vpc.demo.id}" | |
egress { | |
from_port = 0 | |
to_port = 0 | |
protocol = "-1" | |
cidr_blocks = ["0.0.0.0/0"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_eks_cluster" "demo" { | |
name = "${var.cluster-name}" | |
role_arn = "${aws_iam_role.demo-node.arn}" | |
vpc_config { | |
security_group_ids = ["${aws_security_group.demo-cluster.id}"] | |
subnet_ids = ["${aws_subnet.demo.*.id}"] | |
} | |
depends_on = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_iam_role" "demo-cluster" { | |
name = "terraform-eks-demo-cluster" | |
assume_role_policy = <<POLICY | |
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Principal": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_security_group" "demo-node" { | |
name = "terraform-eks-demo-node" | |
description = "Security group for all nodes in the cluster" | |
vpc_id = aws_vpc.demo.id | |
egress { | |
from_port = 0 | |
to_port = 0 | |
protocol = "-1" | |
cidr_blocks = ["0.0.0.0/0"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_security_group_rule" "demo-cluster-ingress-node-https" { | |
description = "Allow pods to communicate with the cluster API Server" | |
from_port = 443 | |
protocol = "tcp" | |
security_group_id = aws_security_group.demo-cluster.id | |
source_security_group_id = aws_security_group.demo-node.id | |
to_port = 443 | |
type = "ingress" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data "aws_ami" "eks-worker" { | |
filter { | |
name = "name" | |
values = ["amazon-eks-node-${aws_eks_cluster.demo.version}-v*"] | |
} | |
most_recent = true | |
owners = ["602401143452"] # Amazon EKS AMI Account ID | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_autoscaling_group" "demo" { | |
desired_capacity = 2 | |
launch_configuration = aws_launch_configuration.demo.id | |
max_size = 2 | |
min_size = 1 | |
name = "terraform-eks-demo" | |
vpc_zone_identifier = [aws_subnet.demo.*.id] | |
tag { | |
key = "Name" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.howtodoinjava; | |
import java.util.Date; | |
import java.util.UUID; | |
import com.amazonaws.services.lambda.runtime.Context; | |
import com.amazonaws.services.lambda.runtime.RequestHandler; | |
public class LambdaFunctionHandler implements RequestHandler<MyLambdaRequest, MyLambdaResponse> { | |
@Override |
OlderNewer