Syntax to add tags in aws eks create-cluster command

0

Hello, Can you provide me the syntax for adding tags for creating eks clusters.

aws eks create-cluster --name $cluster_name --role-arn $role --resources-vpc-config subnetIds=$private_subnet1,$private_subnet1 --tags Tags=[{Key=Name,Value=test1},{Key=Owner,Value=dddd},{Key=Project,Value=yyy},{Key=Environment,Value=Dev},{Key=Scheduling,Value=Automatic},{Key=Department,Value=bbb},{Key=kubernetes.io/cluster/aaa,Value=shared}]"

Kalai
asked 8 months ago488 views
2 Answers
0

The CLI documentation is a little confusing on this flag and maybe even wrong. This is what looks like passing multiple tags through cli --tags flag:

--tags Key=Tag1,Value=Value1 Key=Tag2,Value=Value2

Separate key,values with comma and one tag from another with space.

Let me know if this helps you! Have a nice day.

answered 8 months ago
  • Nope, it is not working, getting the below error.

    bash-3.2$ aws eks create-cluster --name <<name>> --role-arn <<role_arn>> --resources-vpc-config subnetIds=<<id1>>,<<id2>> --tags Key=Name,Value=test1 Key=Owner,Value=<<value>>

    Unknown options: Key=Owner

0

Hi,

For AWS EKS- i would recommend using eksctl tool [1], . It is a command line tool for working with EKS clusters that automates many individual tasks. It will create cloud formation template and deploy cluster as per the options you specify

The eksctl tag command is used to manage tags on EKS clusters and other resources created by eksctl.

The basic syntax for the eksctl tag command is: eksctl tag --cluster=<clusterName> --resource=<resourceType> --tags <key=value,key=value>

example

eksctl tag --cluster=my-cluster --resource=cluster --tags team=dev,env=test

eksctl tag --cluster=my-cluster --resource=nodegroup --tags dept=finance

Reference: [1] - https://docs.aws.amazon.com/eks/latest/userguide/getting-started-eksctl.html & https://eksctl.io/

Thanks

AWS
answered 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions