Add tags to an Amazon EMR cluster
You can add tags to a cluster when you create it.
- Console
-
To add tags when you create a cluster with the new console
-
Sign in to the AWS Management Console, and open the Amazon EMR console at https://console.aws.amazon.com/emr
. -
Under EMR on EC2 in the left navigation pane, choose Clusters, and then choose Create cluster.
-
Under Tags, choose Add new tag. Specify a tag in the Key field. Optionally, specify a tag in the Value field.
-
Choose any other options that apply to your cluster.
-
To launch your cluster, choose Create cluster.
-
- AWS CLI
-
To add tags when you create a cluster with the the AWS CLI
The following example demonstrates how to add a tag to a new cluster using the AWS CLI. To add tags when you create a cluster, type the
create-cluster
subcommand with the--tags
parameter.-
To add a tag named
costCenter
with key valuemarketing
when you create a cluster, type the following command and replacemyKey
with the name of your EC2 key pair.aws emr create-cluster --name
"Test cluster"
--release-labelemr-4.0.0
--applications Name=Hadoop
Name=Hive
Name=Pig
--tags"costCenter=marketing"
--use-default-roles --ec2-attributes KeyName=myKey
--instance-typem5.xlarge
--instance-count3
When you specify the instance count without using the
--instance-groups
parameter, a single Master node is launched, and the remaining instances are launched as core nodes. All nodes will use the instance type specified in the command.Note
If you have not previously created the default EMR service role and EC2 instance profile, type aws
emr create-default-roles
to create them before typing thecreate-cluster
subcommand.For more information on using Amazon EMR commands in the AWS CLI, see https://docs.aws.amazon.com/cli/latest/reference/emr.
-
You can also add tags to an existing cluster.
- Console
-
To add tags to an existing cluster with the new console
-
Sign in to the AWS Management Console, and open the Amazon EMR console at https://console.aws.amazon.com/emr
. -
Under EMR on EC2 in the left navigation pane, choose Clusters, and select the cluster that you want to update.
-
On the Tags tab on the cluster details page, select Manage tags. Specify a tag in the Key field. Optionally, specify a tag in the Value field.
-
Select Save changes. The Tags tab updates with the new number of tags that you have on your cluster. For example, if you now have two tags, the label of your tab is Tags (2).
-
- AWS CLI
-
To add tags to a running cluster with the AWS CLI
-
Enter the
add-tags
subcommand with the--tag
parameter to assign tags to the cluster ID. You can find the cluster ID using the console or thelist-clusters
command. Theadd-tags
subcommand currently accepts only one resource ID.For example, to add two tags to a running cluster one with a key named
costCenter
with a value ofmarketing
and another namedother
with a value ofaccounting
, enter the following command and replacej-KT4XXXXXXXX1NM
with your cluster ID.aws emr add-tags --resource-id
j-KT4XXXXXXXX1NM
--tag"costCenter=marketing"
--tag"other=accounting"
Note that when tags are added using the AWS CLI, there's no output from the command. For more information on using Amazon EMR commands in the AWS CLI, see https://docs.aws.amazon.com/cli/latest/reference/emr.
-