Skip to content

Instantly share code, notes, and snippets.

@otterley
Created March 31, 2020 00:53
Show Gist options
  • Save otterley/54d82bf0da8f6426415f75591a3d5b34 to your computer and use it in GitHub Desktop.
Save otterley/54d82bf0da8f6426415f75591a3d5b34 to your computer and use it in GitHub Desktop.
Minimal EKS cluster CloudFormation template
AWSTemplateFormatVersion: "2010-09-09"
Description: "Deploys the EKS control plane"
Parameters:
VPCID:
Description: ID of your existing VPC for deployment
Type: AWS::EC2::VPC::Id
SubnetIds:
Type: List<AWS::EC2::Subnet::Id>
KubernetesVersion:
Type: String
AllowedValues: [ "1.15", "1.14", "1.13" ]
Default: "1.15"
Resources:
ControlPlaneSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Cluster communication
VpcId: !Ref VPCID
ControlPlaneRole:
Type: "AWS::IAM::Role"
Properties:
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Principal:
Service: eks.amazonaws.com
Action: sts:AssumeRole
ManagedPolicyArns:
- !Sub 'arn:${AWS::Partition}:iam::aws:policy/AmazonEKSClusterPolicy'
- !Sub 'arn:${AWS::Partition}:iam::aws:policy/AmazonEKSServicePolicy'
EKSControlPlane:
Type: "AWS::EKS::Cluster"
Properties:
ResourcesVpcConfig:
SecurityGroupIds:
- !Ref ControlPlaneSecurityGroup
SubnetIds: !Ref SubnetIds
RoleArn: !GetAtt ControlPlaneRole.Arn
Version: !Ref KubernetesVersion
Outputs:
ClusterArn:
Value: !GetAtt EKSControlPlane.Arn
ClusterCAData:
Value: !GetAtt EKSControlPlane.CertificateAuthorityData
ClusterEndpoint:
Value: !GetAtt EKSControlPlane.Endpoint
ClusterName:
Value: !Ref EKSControlPlane
ControlPlaneSecurityGroup:
Value: !Ref ControlPlaneSecurityGroup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment