Table Of Contents

Feedback

User Guide

First time using the AWS CLI? See the User Guide for help getting started.

Note: You are viewing the documentation for an older major version of the AWS CLI (version 1).

AWS CLI version 2, the latest major version of AWS CLI, is now stable and recommended for general use. To view this page for the AWS CLI version 2, click here. For more information see the AWS CLI version 2 installation instructions and migration guide.

[ aws . ce ]

get-tags

Description

Queries for available tag keys and tag values for a specified period. You can search the tag values for an arbitrary string.

See also: AWS API Documentation

See 'aws help' for descriptions of global parameters.

Synopsis

  get-tags
[--search-string <value>]
--time-period <value>
[--tag-key <value>]
[--next-page-token <value>]
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]

Options

--search-string (string)

The value that you want to search for.

--time-period (structure)

The start and end dates for retrieving the dimension values. The start date is inclusive, but the end date is exclusive. For example, if start is 2017-01-01 and end is 2017-05-01 , then the cost and usage data is retrieved from 2017-01-01 up to and including 2017-04-30 but not including 2017-05-01 .

Start -> (string)

The beginning of the time period that you want the usage and costs for. The start date is inclusive. For example, if start is 2017-01-01 , AWS retrieves cost and usage data starting at 2017-01-01 up to the end date.

End -> (string)

The end of the time period that you want the usage and costs for. The end date is exclusive. For example, if end is 2017-05-01 , AWS retrieves cost and usage data from the start date up to, but not including, 2017-05-01 .

Shorthand Syntax:

Start=string,End=string

JSON Syntax:

{
  "Start": "string",
  "End": "string"
}

--tag-key (string)

The key of the tag that you want to return values for.

--next-page-token (string)

The token to retrieve the next set of results. AWS provides the token when the response from a previous call has more results than the maximum page size.

--cli-input-json (string) Performs service operation based on the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, the CLI values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally.

--generate-cli-skeleton (string) Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input, prints a sample input JSON that can be used as an argument for --cli-input-json. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command.

See 'aws help' for descriptions of global parameters.

Examples

To retrieve keys and values for a cost allocation tag

This example retrieves all cost allocation tags with a key of "Project" and a value that contains "secretProject".

Command:

aws ce get-tags --search-string secretProject --time-period Start=2017-01-01,End=2017-05-18 --tag-key Project

Output:

{
  "ReturnSize": 2,
  "Tags": [
    "secretProject1",
    "secretProject2"
  ],
  "TotalSize": 2
}

Output

NextPageToken -> (string)

The token for the next set of retrievable results. AWS provides the token when the response from a previous call has more results than the maximum page size.

Tags -> (list)

The tags that match your request.

(string)

ReturnSize -> (integer)

The number of query results that AWS returns at a time.

TotalSize -> (integer)

The total number of query results.