Lambda / Client / list_aliases

list_aliases#

Lambda.Client.list_aliases(**kwargs)#

Returns a list of aliases for a Lambda function.

See also: AWS API Documentation

Request Syntax

response = client.list_aliases(
    FunctionName='string',
    FunctionVersion='string',
    Marker='string',
    MaxItems=123
)
Parameters:
  • FunctionName (string) –

    [REQUIRED]

    The name or ARN of the Lambda function.

    Name formats

    • Function name - MyFunction.

    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction.

    • Partial ARN - 123456789012:function:MyFunction.

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • FunctionVersion (string) – Specify a function version to only list aliases that invoke that version.

  • Marker (string) – Specify the pagination token that’s returned by a previous request to retrieve the next page of results.

  • MaxItems (integer) – Limit the number of aliases returned.

Return type:

dict

Returns:

Response Syntax

{
    'NextMarker': 'string',
    'Aliases': [
        {
            'AliasArn': 'string',
            'Name': 'string',
            'FunctionVersion': 'string',
            'Description': 'string',
            'RoutingConfig': {
                'AdditionalVersionWeights': {
                    'string': 123.0
                }
            },
            'RevisionId': 'string'
        },
    ]
}

Response Structure

  • (dict) –

    • NextMarker (string) –

      The pagination token that’s included if more results are available.

    • Aliases (list) –

      A list of aliases.

      • (dict) –

        Provides configuration information about a Lambda function alias.

        • AliasArn (string) –

          The Amazon Resource Name (ARN) of the alias.

        • Name (string) –

          The name of the alias.

        • FunctionVersion (string) –

          The function version that the alias invokes.

        • Description (string) –

          A description of the alias.

        • RoutingConfig (dict) –

          The routing configuration of the alias.

          • AdditionalVersionWeights (dict) –

            The second version, and the percentage of traffic that’s routed to it.

            • (string) –

              • (float) –

        • RevisionId (string) –

          A unique identifier that changes when you update the alias.

Exceptions

  • Lambda.Client.exceptions.ServiceException

  • Lambda.Client.exceptions.ResourceNotFoundException

  • Lambda.Client.exceptions.InvalidParameterValueException

  • Lambda.Client.exceptions.TooManyRequestsException

Examples

The following example returns a list of aliases for a function named my-function.

response = client.list_aliases(
    FunctionName='my-function',
)

print(response)

Expected Output:

{
    'Aliases': [
        {
            'AliasArn': 'arn:aws:lambda:us-west-2:123456789012:function:my-function:BETA',
            'Description': 'Production environment BLUE.',
            'FunctionVersion': '2',
            'Name': 'BLUE',
            'RevisionId': 'a410117f-xmpl-494e-8035-7e204bb7933b',
            'RoutingConfig': {
                'AdditionalVersionWeights': {
                    '1': 0.7,
                },
            },
        },
        {
            'AliasArn': 'arn:aws:lambda:us-west-2:123456789012:function:my-function:LIVE',
            'Description': 'Production environment GREEN.',
            'FunctionVersion': '1',
            'Name': 'GREEN',
            'RevisionId': '21d40116-xmpl-40ba-9360-3ea284da1bb5',
        },
    ],
    'ResponseMetadata': {
        '...': '...',
    },
}