{
    "LaunchTemplate":{
        "Type":"AWS::EC2::LaunchTemplate",
        "Properties":{
            "LaunchTemplateData":{
                "BlockDeviceMappings":[
                    {
                        "DeviceName":"/dev/xvdb",
                        "Ebs":{
                            "Iops":3000,
                            "Throughput":125,
                            "VolumeSize":142,
                            "VolumeType":"gp3"
                        }
                    }
                ],
                "CapacityReservationSpecification":{
                    "CapacityReservationPreference":"open"
                },
                "MetadataOptions":{
                    "HttpPutResponseHopLimit":2,
                    "HttpTokens":"required"
                },
                "SecurityGroupIds":[
                    {
                        "Fn::ImportValue":"eksctl-lt::ClusterSecurityGroupId"
                    }
                ],
                "TagSpecifications":[
                    {
                        "ResourceType":"instance",
                        "Tags":[
                            {
                                "Key":"Name",
                                "Value":"lt-capacity-test-Node"
                            },
                            {
                                "Key":"alpha.eksctl.io/nodegroup-name",
                                "Value":"capacity-test"
                            },
                            {
                                "Key":"alpha.eksctl.io/nodegroup-type",
                                "Value":"managed"
                            }
                        ]
                    },
                    {
                        "ResourceType":"volume",
                        "Tags":[
                            {
                                "Key":"Name",
                                "Value":"lt-capacity-test-Node"
                            },
                            {
                                "Key":"alpha.eksctl.io/nodegroup-name",
                                "Value":"capacity-test"
                            },
                            {
                                "Key":"alpha.eksctl.io/nodegroup-type",
                                "Value":"managed"
                            }
                        ]
                    },
                    {
                        "ResourceType":"network-interface",
                        "Tags":[
                            {
                                "Key":"Name",
                                "Value":"lt-capacity-test-Node"
                            },
                            {
                                "Key":"alpha.eksctl.io/nodegroup-name",
                                "Value":"capacity-test"
                            },
                            {
                                "Key":"alpha.eksctl.io/nodegroup-type",
                                "Value":"managed"
                            }
                        ]
                    }
                ]
            },
            "LaunchTemplateName":{
                "Fn::Sub":"${AWS::StackName}"
            }
        }
    },
    "ManagedNodeGroup":{
        "Type":"AWS::EKS::Nodegroup",
        "Properties":{
            "AmiType":"BOTTLEROCKET_x86_64",
            "ClusterName":"lt",
            "InstanceTypes":[
                "m5.xlarge"
            ],
            "Labels":{
                "alpha.eksctl.io/cluster-name":"lt",
                "alpha.eksctl.io/nodegroup-name":"capacity-test"
            },
            "LaunchTemplate":{
                "Id":{
                    "Ref":"LaunchTemplate"
                }
            },
            "NodeRole":{
                "Fn::GetAtt":[
                    "NodeInstanceRole",
                    "Arn"
                ]
            },
            "NodegroupName":"capacity-test",
            "ScalingConfig":{
                "DesiredSize":2,
                "MaxSize":2,
                "MinSize":2
            },
            "Subnets": [
                "subnet-public-us-west-2a"
            ],
            "Tags":{
                "alpha.eksctl.io/nodegroup-name":"capacity-test",
                "alpha.eksctl.io/nodegroup-type":"managed"
            }
        }
    },
    "NodeInstanceRole":{
        "Type":"AWS::IAM::Role",
        "Properties":{
            "AssumeRolePolicyDocument":{
                "Statement":[
                    {
                        "Action":[
                            "sts:AssumeRole"
                        ],
                        "Effect":"Allow",
                        "Principal":{
                            "Service":[
                                {
                                    "Fn::FindInMap":[
                                        "ServicePrincipalPartitionMap",
                                        {
                                            "Ref":"AWS::Partition"
                                        },
                                        "EC2"
                                    ]
                                }
                            ]
                        }
                    }
                ],
                "Version":"2012-10-17"
            },
            "ManagedPolicyArns":[
                {
                    "Fn::Sub":"arn:${AWS::Partition}:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly"
                },
                {
                    "Fn::Sub":"arn:${AWS::Partition}:iam::aws:policy/AmazonEKSWorkerNodePolicy"
                },
                {
                    "Fn::Sub":"arn:${AWS::Partition}:iam::aws:policy/AmazonEKS_CNI_Policy"
                },
                {
                    "Fn::Sub":"arn:${AWS::Partition}:iam::aws:policy/AmazonSSMManagedInstanceCore"
                }
            ],
            "Path":"/",
            "Tags":[
                {
                    "Key":"Name",
                    "Value":{
                        "Fn::Sub":"${AWS::StackName}/NodeInstanceRole"
                    }
                }
            ]
        }
    }
}
