Steps to Create EKS cluster using Cloudformation on AWS

Hello, In this blog we are discussing how to create EKS cluster using Cloudformation. Cloudformation provides a platform where we can easily create a template and run the json/ymal code. It provides a way to create a collection of related aws services.

There are some points to create EKS cluster using cloudformation & also find the given below eks cluster json code:

  • Login to aws console.
  • Click on Services.
  • Click on Management & Governance service & Select cloudformation.

  • Click on Create Stack.

  • In Prepare template,select Create Template in designer for creating a new template.

  • Click on Create Template in Designer option.

  • At the bottom,there are two options: Components & template.
  • Select template option.

  • First remove the already mentioned code.

  • Then Add the following code in Json Formation.

{
"AWSTemplateFormatVersion": "2010-09-09",
"Parameters": {
"eksclustername": {
"Type": "String",
"Default": "cluster-name",
"Description": "Name of the EKS cluster."
},
"eksversion": {
"Type": "String",
"Default": "1.21"
}
},
"Resources": {
"EKSCluster": {
"Type": "AWS::EKS::Cluster",
"Properties": {
"Name": {
"Ref": "eksclustername"
},
"Version": {
"Ref": "eksversion"
},
"RoleArn": "Type-EKS CLuster Role ARN",
"ResourcesVpcConfig": {
"SecurityGroupIds": [
"sg-06c82622fee88fde8"
],
"SubnetIds": [
"subnet-91e949f4",
"subnet-f4a06483"
],
"EndpointPublicAccess": false,
"EndpointPrivateAccess": true
},
"Logging": {
"ClusterLogging": {
"EnabledTypes": [{
"Type": "api"
},
{
"Type": "audit"
}]
}} }
}
},
"Outputs": {
"eksclustername": {
"Value": {
"Ref": "EKSCluster"
},
"Description": "Name of the Eks cluster",
"Export": {
"Name": {
"Fn::Sub": "${AWS::StackName}-eksclustername"
}
}
}
}
}

  • Click on Create Stack.

  • Click on Next.

  • Provide the Stack Name.
  • Set the Parameters  & Click on Next.

  • In Configure Stack options, Provide tag key name & value.

  • Click on Next.

  • In Review,check all configurations.

  • Click on Create Stack.

  • After sometimes, Stack is Ready.

  • Go to EKS cluster & check created eks cluster name.

Leave a Reply

Your email address will not be published.