Add tags to a cluster
You can add tags to a cluster when you create it.
Note
We’ve redesigned the Amazon EMR console to make it easier to use. See Amazon EMR console to learn about the differences between the old and new console experiences.
- New 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.
-
- Old console
-
To add tags when you create a cluster with the old console
Navigate to the new Amazon EMR console and select Switch to the old console from the side navigation. For more information on what to expect when you switch to the old console, see Using the old console.
-
Choose Create cluster, Go to advanced options.
-
On the Step 3: General Cluster Settings page, in the Tags section, type a Key for your tag.
When you begin typing the Key, a new row automatically appears to provide space for the next new tag.
-
Optionally, type a Value for the tag.
-
Repeat the previous steps for each tag key/value pair to add to the cluster. When the cluster launches, any tags you enter are automatically associated with the 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.
- New 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).
-
- Old console
-
To add tags to an existing cluster with the old console
-
In the Amazon EMR console, select the Cluster List page and click a cluster to which to add tags.
-
On the Cluster Details page, in the Tags field, click View All/Edit.
-
On the View All/Edit page, click Add.
-
Click the empty field in the Key column and type the name of your key.
-
Optionally, click the empty field in the Value column and type the name of your value.
-
With each new tag you begin, another empty tag line appears under the tag you are currently editing. Repeat the previous steps on the new tag line for each tag to add.
-
- 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.
-