You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This Terraform code for creating EKS cluster, including a private subnet, IAM role for EKS worker nodes with attached policies such as AmazonEKSWorkerNodePolicy, AmazonEC2ContainerRegistryReadOnly, and AmazonEKS_CNI_Policy. then deploys an Amazon EKS cluster within the VPC, along with a node group for worker nodes. Additionally, it provisions EC2 instances with basic configurations and manages SSH key pairs for secure access to these instances.
provider.tf :
provider "aws" {
region = "us-east-2" # Change to your desired AWS region
profile = "tf-navez"
}
resource "aws_eks_cluster" "my_cluster" {
name = "my-eks-cluster"
role_arn = "arn:aws:iam::93478594:role/aws-service-role/eks.amazonaws.com/AWSServiceRoleForAmazonEKS" # Change to your EKS service role ARN
# version = "1.21" # Change to your desired EKS version
vpc_config {
subnet_ids = [
aws_subnet.private_subnet_a.id,
aws_subnet.private_subnet_b.id,
]
}
}