agent: |
cfNos3sj0Lx7A3gUsXe7Create an EKS cluster in region us-west-2 using the pre-configured VPC, security groups, and IAM roles with Kubernetes version 1.31.
Create an EKS cluster in region us-west-2 using the pre-configured VPC, security groups, and IAM roles with Kubernetes version 1.31.
There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.
This script creates an EKS cluster in the us-west-2 region using the specified VPC, security groups, and IAM roles with Kubernetes version 1.32, and outputs the ARN of the created EKS cluster.
inputs
outputs
import boto3
import json
def create_managed_node_group(cluster_name, nodegroup_name, instance_type, ami_type, disk_size, min_size, max_size, desired_size, subnet_ids, worker_role_arn, region):
eks_client = boto3.client(
'eks',
region_name=region,
aws_access_key_id=getEnvVar('AWS_ACCESS_KEY_ID'),
aws_secret_access_key=getEnvVar('AWS_SECRET_ACCESS_KEY')
)
try:
response = eks_client.create_nodegroup(
clusterName=cluster_name,
nodegroupName=nodegroup_name,
scalingConfig={
'minSize': min_size,
'maxSize': max_size,
'desiredSize': desired_size
},
diskSize=disk_size,
subnets=subnet_ids,
instanceTypes=[instance_type],
amiType=ami_type,
nodeRole=worker_role_arn
)
nodegroup_status = response['nodegroup']['status']
print(f"Nodegroup Status: {nodegroup_status}")
return nodegroup_status
except Exception as e:
print(f"Error: {str(e)}")
return f"Error: {str(e)}"
nodegroup_status = create_managed_node_group(
eks_cluster_name,
nodegroup_name,
instance_type,
ami_type,
disk_size,
min_size,
max_size,
desired_size,
subnet_ids,
worker_role_arn,
region
)
copied