Working with Tags on AWS OpsWorks for Puppet Enterprise Resources - AWS OpsWorks

Working with Tags on AWS OpsWorks for Puppet Enterprise Resources

Tags are words or phrases that act as metadata for identifying and organizing your AWS resources. In OpsWorks for Puppet Enterprise, a resource can have up to 50 user-applied tags. Each tag consists of a key and one optional value. You can apply tags to the following resources in OpsWorks for Puppet Enterprise:

  • OpsWorks for Puppet Enterprise servers

  • Backups of OpsWorks for Puppet Enterprise servers

Tags on AWS resources can help you track costs, control access to resources, group resources for automating tasks, or organize resources by purpose or lifecycle stage. For more information about the benefits of tags, see AWS Tagging Strategies in AWS Answers and Using Cost Allocation Tags in the AWS Billing and Cost Management User Guide.

To use tags to control access to OpsWorks for Puppet Enterprise servers or backups, create or edit policy statements in AWS Identity and Access Management (IAM). For more information, see Controlling Access to AWS Resources Using Resource Tags in the AWS Identity and Access Management User Guide.

When you apply tags to an OpsWorks for Puppet Enterprise master, the tags are also applied to the master's backups, the Amazon S3 bucket that stores the backups, the master's Amazon EC2 instance, and the Elastic IP address used by the master. Tags are not propagated to the AWS CloudFormation stack that AWS OpsWorks uses to create your Puppet master.

How Tags Work in AWS OpsWorks for Puppet Enterprise

In this release, you can add and manage tags by using the AWS OpsWorks CM API or the AWS Management Console. AWS OpsWorks CM also attempts to add tags that you add to a server to the AWS resources that are associated with the server, including the EC2 instance, Elastic IP address, security group, S3 bucket, and backups.

The following table provides an overview of how you add and manage tags in OpsWorks for Puppet Enterprise.

Action What to use
Add tags to a new OpsWorks for Puppet Enterprise server or a backup that you are creating manually.
  • Choose Create Puppet Enterprise server and add tags on the Configure advanced settings page.

  • Choose Create backup on the Backups page for an existing server, and add tags on the Create a backup of your Puppet Enterprise server page.

  • Add a Tags parameter to the CreateServer or CreateBackup commands.

View tags on a resource.
  • On the details page for your server, choose Tags in the navigation pane.

  • On the Backups page for your server, select a backup, and then choose Edit backup.

  • Run the ListTagsForResource command.

Add tags to an existing OpsWorks for Puppet Enterprise server or a backup, regardless of whether the backup was created manually or automatically.
  • On the details page for your server, choose Tags in the navigation pane, and then choose Edit.

  • On the Backups page for your server, select a backup, and then choose Edit backup.

  • Run the TagResource command.

Delete tags from a resource.
  • On the details page for your server, choose Tags in the navigation pane, and then choose Edit. Choose X next to tags that you want to delete.

  • On the Backups page for your server, select a backup, and then choose Edit backup. Choose X next to tags that you want to delete.

  • Run the UntagResource command.

DescribeServers and DescribeBackups responses do not include tag information. To show tags, use the ListTagsForResource API.

Add and Manage Tags in OpsWorks for Puppet Enterprise (Console)

Procedures in this section are performed in the AWS Management Console.

If you add tags, a tag key cannot be empty. The key can be a maximum of 127 characters, and can contain only Unicode letters, numbers, or separators, or the following special characters: + - = . _ : / @ A tag value is optional. You can add a tag that has a key, but no value. The value can be a maximum of 255 characters, and can contain only Unicode letters, numbers, or separators, or the following special characters: + - = . _ : / @

Add Tags to a New OpsWorks for Puppet Enterprise Server (Console)

  1. Be sure to complete any prerequisites for creating an OpsWorks for Puppet Enterprise master.

  2. Follow steps 1-8 in Create a Puppet Enterprise Master by using the AWS Management Console.

  3. After you specify automated backup settings, add tags in the Tags area of the Configure advanced settings page. You can add a maximum of 50 tags. When you are finished adding tags, choose Next.

  4. Go on to step 11 of Create a Puppet Enterprise Master by using the AWS Management Console, and review settings you have chosen for the new server.

Add Tags to a New Backup (Console)

  1. On the OpsWorks for Puppet Enterprise home page, choose an existing Puppet master.

  2. From the server's details page, choose Backups in the navigation pane.

  3. On the Backups page, choose Create backup.

  4. Add tags. Choose Create when you are finished adding tags.

Add or View Tags on an Existing Server (Console)

  1. On the OpsWorks for Puppet Enterprise home page, choose an existing Puppet master to open its details page.

  2. Choose Tags in the navigation pane, or at the bottom of the details page, choose View all tags.

  3. On the Tags page, choose Edit.

  4. Add or edit tags on the server. Choose Save when you are finished.

    Note

    Be aware that changing tags on your Puppet master also changes tags on resources that are associated with the server, such as the EC2 instance, Elastic IP address, security group, S3 bucket, and backups.

Add or View Tags on an Existing Backup (Console)

  1. On the OpsWorks for Puppet Enterprise home page, choose an existing Puppet master to open its details page.

  2. Choose Backups in the navigation pane, or in the Recent backups area of the details page, choose View all backups.

  3. On the Backups page, choose a backup to manage, and then choose Edit backup.

  4. Add or edit tags on the backup. Choose Update when you are finished.

Delete Tags from a Server (Console)

  1. On the OpsWorks for Puppet Enterprise home page, choose an existing Puppet master to open its details page.

  2. Choose Tags in the navigation pane, or at the bottom of the details page, choose View all tags.

  3. On the Tags page, choose Edit.

  4. Choose X next to a tag to delete the tag. Choose Save when you are finished.

    Note

    Be aware that changing tags on your Puppet master also changes tags on resources that are associated with the server, such as the EC2 instance, Elastic IP address, security group, S3 bucket, and backups.

Delete Tags from a Backup (Console)

  1. On the OpsWorks for Puppet Enterprise home page, choose an existing Puppet master to open its details page.

  2. Choose Backups in the navigation pane, or in the Recent backups area of the details page, choose View all backups.

  3. On the Backups page, choose a backup to manage, and then choose Edit backup.

  4. Choose X next to a tag to delete the tag. Choose Update when you are finished.

Add and Manage Tags in OpsWorks for Puppet Enterprise (CLI)

Procedures in this section are performed in the AWS CLI. Be sure that you are running the latest release of the AWS CLI before you start working with tags. For more information about installing or updating the AWS CLI, see Installing the AWS CLI in the AWS Command Line Interface User Guide.

If you add tags, a tag key cannot be empty. The key can be a maximum of 127 characters, and can contain only Unicode letters, numbers, or separators, or the following special characters: + - = . _ : / @ A tag value is optional. You can add a tag that has a key, but no value. The value can be a maximum of 255 characters, and contain only Unicode letters, numbers, or separators, or the following special characters: + - = . _ : / @

Add Tags to a New OpsWorks for Puppet Enterprise Server (CLI)

You can use the AWS CLI to add tags when you create an OpsWorks for Puppet Enterprise server. This procedure does not describe in full how to create a server. For detailed information about how to create an OpsWorks for Puppet Enterprise server by using the AWS CLI, see Create a Puppet Enterprise Master by using the AWS CLI in this guide. You can add up to 50 tags to a server.

  1. Be sure to complete any prerequisites for creating an OpsWorks for Puppet Enterprise server.

  2. Complete steps 1-4 of Create a Puppet Enterprise Master by using the AWS CLI.

  3. For step 5, when you run the create-server command, add the --tags parameter to the command, as shown in the following example.

    aws opsworks-cm create-server ... --tags Key=Key1,Value=Value1 Key=Key2,Value=Value2

    The following is an example showing only the tags portion of the create-server command.

    aws opsworks-cm create-server ... --tags Key=Stage,Value=Production Key=Department,Value=Marketing
  4. Complete the remaining steps in Create a Puppet Enterprise Master by using the AWS CLI. To verify that your tags were added to the new server, follow steps in List Resource Tags (CLI) in this topic.

Add Tags to a New Backup (CLI)

You can use the AWS CLI to add tags when you create a new, manual backup of an OpsWorks for Puppet Enterprise server. This procedure does not describe in full how to create a manual backup. For detailed information about how to create a manual backup, see "To perform a manual backup in the AWS CLI" in Back Up an OpsWorks for Puppet Enterprise Server. You can add up to 50 tags to a backup. If a server has tags, new backups are automatically tagged with the server's tags.

By default, when you create a new OpsWorks for Puppet Enterprise server, automated backups are enabled. You can add tags to an automated backup by running the tag-resource command, described in Add Tags to Existing Servers or Backups (CLI) in this topic.

  • To add tags to a manual backup as you're creating the backup, run the following command. Only the tags portion of the command is shown. For an example of the full create-backup command, see "To perform a manual backup in the AWS CLI" in Back Up an OpsWorks for Puppet Enterprise Server.

    aws opsworks-cm create-backup ... --tags Key=Key1,Value=Value1 Key=Key2,Value=Value2

    The following example shows only the tags portion of the create-backup command.

    aws opsworks-cm create-backup ... --tags Key=Stage,Value=Production Key=Department,Value=Marketing

Add Tags to Existing Servers or Backups (CLI)

You can run the tag-resource command to add tags to existing OpsWorks for Puppet Enterprise servers or backups (whether the backups were created automatically or manually). Specify the Amazon Resource Number (ARN) of a target resource to add tags to it.

  1. To get the ARN of the resource to which you want to apply tags:

    • For a server, run describe-servers --server-name server_name. The results of the command show the server ARN.

    • For a backup, run describe-backups --backup-id backup_ID. The results of the command show the backup ARN. You can also run describe-backups --server-name server_name to show information about all backups for a specific OpsWorks for Puppet Enterprise server.

    The following example shows only the ServerArn in results of a describe-servers --server-name opsworks-cm-test command. The ServerArn value is added to a tag-resource command to add tags to the server.

    { "Servers": [ { ... "ServerArn": "arn:aws:opsworks-cm:us-west-2:123456789012:server/opsworks-cm-test/EXAMPLEd-66b0-4196-8274-d1a2bEXAMPLE" } ] }
  2. Run the tag-resource command with the ARN that you returned in step 1.

    aws opsworks-cm tag-resource --resource-arn "server_or_backup_ARN" --tags Key=Key1,Value=Value1 Key=Key2,Value=Value2

    The following is an example.

    aws opsworks-cm tag-resource --resource-arn "arn:aws:opsworks-cm:us-west-2:123456789012:server/opsworks-cm-test/EXAMPLEd-66b0-4196-8274-d1a2bEXAMPLE" --tags Key=Stage,Value=Production Key=Department,Value=Marketing
  3. To verify that tags were added successfully, go on to the next procedure, List Resource Tags (CLI).

List Resource Tags (CLI)

You can run the list-tags-for-resource command to show the tags that are attached to OpsWorks for Puppet Enterprise servers or backups. Specify the ARN of a target resource to view its tags.

  1. To get the ARN of the resource for which you want to list tags:

    • For a server, run describe-servers --server-name server_name. The results of the command show the server ARN.

    • For a backup, run describe-backups --backup-id backup_ID. The results of the command show the backup ARN. You can also run describe-backups --server-name server_name to show information about all backups for a specific OpsWorks for Puppet Enterprise server.

  2. Run the list-tags-for-resource command with the ARN that you returned in step 1.

    aws opsworks-cm list-tags-for-resource --resource-arn "server_or_backup_ARN"

    The following is an example.

    aws opsworks-cm tag-resource --resource-arn "arn:aws:opsworks-cm:us-west-2:123456789012:server/opsworks-cm-test/EXAMPLEd-66b0-4196-8274-d1a2bEXAMPLE"

    If there are tags on the resource, the command returns results like the following.

    { "Tags": [ { "Key": "Stage", "Value": "Production" }, { "Key": "Department", "Value": "Marketing" } ] }

Delete Tags from a Resource (CLI)

You can run the untag-resource command to delete tags from OpsWorks for Puppet Enterprise servers or backups. If the resource is deleted, tags on the resource are also deleted. Specify the Amazon Resource Number (ARN) of a target resource to remove tags from it.

  1. To get the ARN of the resource from which you want to remove tags:

    • For a server, run describe-servers --server-name server_name. The results of the command show the server ARN.

    • For a backup, run describe-backups --backup-id backup_ID. The results of the command show the backup ARN. You can also run describe-backups --server-name server_name to show information about all backups for a specific OpsWorks for Puppet Enterprise server.

  2. Run the untag-resource command with the ARN that you returned in step 1. Specify only the tags that you want to delete.

    aws opsworks-cm untag-resource --resource-arn "server_or_backup_ARN" --tags Key=Key1,Value=Value1 Key=Key2,Value=Value2

    In this example, the untag-resource command removes only the tag with a key of Stage and a value of Production.

    aws opsworks-cm untag-resource --resource-arn "arn:aws:opsworks-cm:us-west-2:123456789012:server/opsworks-cm-test/EXAMPLEd-66b0-4196-8274-d1a2bEXAMPLE" --tags Key=Stage,Value=Production
  3. To verify that tags were deleted successfully, follow steps in List Resource Tags (CLI) in this topic.

See Also