import pulumi
import pulumi_aws as aws
# Create a VPC and subnets for the EKS cluster
vpc = aws.ec2.Vpc("vpc", cidr_block="10.0.0.0/16")
subnet_ids = []
for zone in ["a", "b", "c"]:
subnet = aws.ec2.Subnet(f"subnet-{zone}",
vpc_id=vpc.id,
cidr_block=f"10.0.{zone}.0/24",
availability_zone=f"{aws.get_region()}{zone}")
subnet_ids.append(subnet.id)
# Create the EKS cluster control plane
eks = aws.eks.Cluster("eks",
vpc_config=aws.eks.ClusterVpcConfigArgs(
subnet_ids=subnet_ids,
security_group_ids=[vpc.default_security_group_id]))
# Create a managed node group for the EKS cluster
nodegroup = aws.eks.NodeGroup("nodes",
cluster_name=eks.name,
node_group_name="ng-1",
node_role_arn=eks.node_role_arn,
subnet_ids=subnet_ids)
# Create an EKS managed ALB ingress controller
alb_controller = aws.helm.Chart("alb-ingress",
repository="https://aws.github.io/eks-charts",
chart="aws-load-balancer-controller",
namespace="kube-system",
cluster=eks.name,
values={
"clusterName": eks.name
})
This creates a VPC, subnets, EKS cluster, managed node group, and ALB ingress controller. Additional resources like IAM roles, security groups, etc are handled implicitly. This provides a basic EKS cluster infrastructure ready for deploying Kubernetes applications.