Amazon Prometheus Service

2025/11/12 - Amazon Prometheus Service - 3 updated api methods

Changes  Add VPC source configuration support enabling Amazon Managed Service for Prometheus Collector to collect metrics from MSK clusters.

CreateScraper (updated) Link ¶
Changes (request)
{'source': {'vpcConfiguration': {'securityGroupIds': ['string'],
                                 'subnetIds': ['string']}}}

The CreateScraper operation creates a scraper to collect metrics. A scraper pulls metrics from Prometheus-compatible sources and sends them to your Amazon Managed Service for Prometheus workspace. You can configure scrapers to collect metrics from Amazon EKS clusters, Amazon MSK clusters, or from VPC-based sources that support DNS-based service discovery. Scrapers are flexible, and can be configured to control what metrics are collected, the frequency of collection, what transformations are applied to the metrics, and more.

An IAM role will be created for you that Amazon Managed Service for Prometheus uses to access the metrics in your source. You must configure this role with a policy that allows it to scrape metrics from your source. For Amazon EKS sources, see Configuring your Amazon EKS cluster in the Amazon Managed Service for Prometheus User Guide.

The scrapeConfiguration parameter contains the base-64 encoded YAML configuration for the scraper.

When creating a scraper, the service creates a Network Interface in each Availability Zone that are passed into CreateScraper through subnets. These network interfaces are used to connect to your source within the VPC for scraping metrics.

See also: AWS API Documentation

Request Syntax

client.create_scraper(
    alias='string',
    scrapeConfiguration={
        'configurationBlob': b'bytes'
    },
    source={
        'eksConfiguration': {
            'clusterArn': 'string',
            'securityGroupIds': [
                'string',
            ],
            'subnetIds': [
                'string',
            ]
        },
        'vpcConfiguration': {
            'securityGroupIds': [
                'string',
            ],
            'subnetIds': [
                'string',
            ]
        }
    },
    destination={
        'ampConfiguration': {
            'workspaceArn': 'string'
        }
    },
    roleConfiguration={
        'sourceRoleArn': 'string',
        'targetRoleArn': 'string'
    },
    clientToken='string',
    tags={
        'string': 'string'
    }
)
type alias:

string

param alias:

(optional) An alias to associate with the scraper. This is for your use, and does not need to be unique.

type scrapeConfiguration:

dict

param scrapeConfiguration:

[REQUIRED]

The configuration file to use in the new scraper. For more information, see Scraper configuration in the Amazon Managed Service for Prometheus User Guide.

  • configurationBlob (bytes) --

    The base 64 encoded scrape configuration file.

type source:

dict

param source:

[REQUIRED]

The Amazon EKS or Amazon Web Services cluster from which the scraper will collect metrics.

  • eksConfiguration (dict) --

    The Amazon EKS cluster from which a scraper collects metrics.

    • clusterArn (string) -- [REQUIRED]

      ARN of the Amazon EKS cluster.

    • securityGroupIds (list) --

      A list of the security group IDs for the Amazon EKS cluster VPC configuration.

      • (string) --

        ID of a VPC security group.

    • subnetIds (list) -- [REQUIRED]

      A list of subnet IDs for the Amazon EKS cluster VPC configuration.

      • (string) --

        ID of a VPC subnet.

  • vpcConfiguration (dict) --

    The Amazon VPC configuration for the Prometheus collector when connecting to Amazon MSK clusters. This configuration enables secure, private network connectivity between the collector and your Amazon MSK cluster within your Amazon VPC.

    • securityGroupIds (list) -- [REQUIRED]

      The security group IDs that control network access for the Prometheus collector. These security groups must allow the collector to communicate with your Amazon MSK cluster on the required ports.

      • (string) --

        ID of a VPC security group.

    • subnetIds (list) -- [REQUIRED]

      The subnet IDs where the Prometheus collector will be deployed. The subnets must be in the same Amazon VPC as your Amazon MSK cluster and have network connectivity to the cluster.

      • (string) --

        ID of a VPC subnet.

type destination:

dict

param destination:

[REQUIRED]

The Amazon Managed Service for Prometheus workspace to send metrics to.

  • ampConfiguration (dict) --

    The Amazon Managed Service for Prometheus workspace to send metrics to.

    • workspaceArn (string) -- [REQUIRED]

      ARN of the Amazon Managed Service for Prometheus workspace.

type roleConfiguration:

dict

param roleConfiguration:

Use this structure to enable cross-account access, so that you can use a target account to access Prometheus metrics from source accounts.

  • sourceRoleArn (string) --

    The Amazon Resource Name (ARN) of the role used in the source account to enable cross-account scraping. For information about the contents of this policy, see Cross-account setup.

  • targetRoleArn (string) --

    The Amazon Resource Name (ARN) of the role used in the target account to enable cross-account scraping. For information about the contents of this policy, see Cross-account setup.

type clientToken:

string

param clientToken:

(Optional) A unique, case-sensitive identifier that you can provide to ensure the idempotency of the request.

This field is autopopulated if not provided.

type tags:

dict

param tags:

(Optional) The list of tag keys and values to associate with the scraper.

  • (string) --

    The key of the tag. Must not begin with aws:.

    • (string) --

      The value of the tag.

rtype:

dict

returns:

Response Syntax

{
    'scraperId': 'string',
    'arn': 'string',
    'status': {
        'statusCode': 'CREATING'|'UPDATING'|'ACTIVE'|'DELETING'|'CREATION_FAILED'|'UPDATE_FAILED'|'DELETION_FAILED'
    },
    'tags': {
        'string': 'string'
    }
}

Response Structure

  • (dict) --

    Represents the output of a CreateScraper operation.

    • scraperId (string) --

      The ID of the new scraper.

    • arn (string) --

      The Amazon Resource Name (ARN) of the new scraper.

    • status (dict) --

      A structure that displays the current status of the scraper.

      • statusCode (string) --

        The current status of the scraper.

    • tags (dict) --

      The list of tag keys and values that are associated with the scraper.

      • (string) --

        The key of the tag. Must not begin with aws:.

        • (string) --

          The value of the tag.

DescribeScraper (updated) Link ¶
Changes (response)
{'scraper': {'source': {'vpcConfiguration': {'securityGroupIds': ['string'],
                                             'subnetIds': ['string']}}}}

The DescribeScraper operation displays information about an existing scraper.

See also: AWS API Documentation

Request Syntax

client.describe_scraper(
    scraperId='string'
)
type scraperId:

string

param scraperId:

[REQUIRED]

The ID of the scraper to describe.

rtype:

dict

returns:

Response Syntax

{
    'scraper': {
        'alias': 'string',
        'scraperId': 'string',
        'arn': 'string',
        'roleArn': 'string',
        'status': {
            'statusCode': 'CREATING'|'UPDATING'|'ACTIVE'|'DELETING'|'CREATION_FAILED'|'UPDATE_FAILED'|'DELETION_FAILED'
        },
        'createdAt': datetime(2015, 1, 1),
        'lastModifiedAt': datetime(2015, 1, 1),
        'tags': {
            'string': 'string'
        },
        'statusReason': 'string',
        'scrapeConfiguration': {
            'configurationBlob': b'bytes'
        },
        'source': {
            'eksConfiguration': {
                'clusterArn': 'string',
                'securityGroupIds': [
                    'string',
                ],
                'subnetIds': [
                    'string',
                ]
            },
            'vpcConfiguration': {
                'securityGroupIds': [
                    'string',
                ],
                'subnetIds': [
                    'string',
                ]
            }
        },
        'destination': {
            'ampConfiguration': {
                'workspaceArn': 'string'
            }
        },
        'roleConfiguration': {
            'sourceRoleArn': 'string',
            'targetRoleArn': 'string'
        }
    }
}

Response Structure

  • (dict) --

    Represents the output of a DescribeScraper operation.

    • scraper (dict) --

      Contains details about the scraper.

      • alias (string) --

        (Optional) A name associated with the scraper.

      • scraperId (string) --

        The ID of the scraper. For example, s-example1-1234-abcd-5678-ef9012abcd34.

      • arn (string) --

        The Amazon Resource Name (ARN) of the scraper. For example, arn:aws:aps:<region>:123456798012:scraper/s-example1-1234-abcd-5678-ef9012abcd34.

      • roleArn (string) --

        The Amazon Resource Name (ARN) of the IAM role that provides permissions for the scraper to discover and collect metrics on your behalf.

        For example, arn:aws:iam::123456789012:role/service-role/AmazonGrafanaServiceRole-12example.

      • status (dict) --

        A structure that contains the current status of the scraper.

        • statusCode (string) --

          The current status of the scraper.

      • createdAt (datetime) --

        The date and time that the scraper was created.

      • lastModifiedAt (datetime) --

        The date and time that the scraper was last modified.

      • tags (dict) --

        (Optional) The list of tag keys and values associated with the scraper.

        • (string) --

          The key of the tag. Must not begin with aws:.

          • (string) --

            The value of the tag.

      • statusReason (string) --

        If there is a failure, the reason for the failure.

      • scrapeConfiguration (dict) --

        The configuration in use by the scraper.

        • configurationBlob (bytes) --

          The base 64 encoded scrape configuration file.

      • source (dict) --

        The Amazon EKS cluster from which the scraper collects metrics.

        • eksConfiguration (dict) --

          The Amazon EKS cluster from which a scraper collects metrics.

          • clusterArn (string) --

            ARN of the Amazon EKS cluster.

          • securityGroupIds (list) --

            A list of the security group IDs for the Amazon EKS cluster VPC configuration.

            • (string) --

              ID of a VPC security group.

          • subnetIds (list) --

            A list of subnet IDs for the Amazon EKS cluster VPC configuration.

            • (string) --

              ID of a VPC subnet.

        • vpcConfiguration (dict) --

          The Amazon VPC configuration for the Prometheus collector when connecting to Amazon MSK clusters. This configuration enables secure, private network connectivity between the collector and your Amazon MSK cluster within your Amazon VPC.

          • securityGroupIds (list) --

            The security group IDs that control network access for the Prometheus collector. These security groups must allow the collector to communicate with your Amazon MSK cluster on the required ports.

            • (string) --

              ID of a VPC security group.

          • subnetIds (list) --

            The subnet IDs where the Prometheus collector will be deployed. The subnets must be in the same Amazon VPC as your Amazon MSK cluster and have network connectivity to the cluster.

            • (string) --

              ID of a VPC subnet.

      • destination (dict) --

        The Amazon Managed Service for Prometheus workspace the scraper sends metrics to.

        • ampConfiguration (dict) --

          The Amazon Managed Service for Prometheus workspace to send metrics to.

          • workspaceArn (string) --

            ARN of the Amazon Managed Service for Prometheus workspace.

      • roleConfiguration (dict) --

        This structure displays information about the IAM roles used for cross-account scraping configuration.

        • sourceRoleArn (string) --

          The Amazon Resource Name (ARN) of the role used in the source account to enable cross-account scraping. For information about the contents of this policy, see Cross-account setup.

        • targetRoleArn (string) --

          The Amazon Resource Name (ARN) of the role used in the target account to enable cross-account scraping. For information about the contents of this policy, see Cross-account setup.

ListScrapers (updated) Link ¶
Changes (response)
{'scrapers': {'source': {'vpcConfiguration': {'securityGroupIds': ['string'],
                                              'subnetIds': ['string']}}}}

The ListScrapers operation lists all of the scrapers in your account. This includes scrapers being created or deleted. You can optionally filter the returned list.

See also: AWS API Documentation

Request Syntax

client.list_scrapers(
    filters={
        'string': [
            'string',
        ]
    },
    nextToken='string',
    maxResults=123
)
type filters:

dict

param filters:

(Optional) A list of key-value pairs to filter the list of scrapers returned. Keys include status, sourceArn, destinationArn, and alias.

Filters on the same key are OR'd together, and filters on different keys are AND'd together. For example, status=ACTIVE&status=CREATING&alias=Test, will return all scrapers that have the alias Test, and are either in status ACTIVE or CREATING.

To find all active scrapers that are sending metrics to a specific Amazon Managed Service for Prometheus workspace, you would use the ARN of the workspace in a query:

status=ACTIVE&destinationArn=arn:aws:aps:us-east-1:123456789012:workspace/ws-example1-1234-abcd-56ef-123456789012

If this is included, it filters the results to only the scrapers that match the filter.

  • (string) --

    The name of the key to filter by. Currently supported filter keys are status, sourceArn, destinationArn, and alias.

    • (list) --

      The values of the given key by which to filter.

      • (string) --

        The value for a given key by which to filter.

type nextToken:

string

param nextToken:

(Optional) The token for the next set of items to return. (You received this token from a previous call.)

type maxResults:

integer

param maxResults:

Optional) The maximum number of scrapers to return in one ListScrapers operation. The range is 1-1000.

If you omit this parameter, the default of 100 is used.

rtype:

dict

returns:

Response Syntax

{
    'scrapers': [
        {
            'alias': 'string',
            'scraperId': 'string',
            'arn': 'string',
            'roleArn': 'string',
            'status': {
                'statusCode': 'CREATING'|'UPDATING'|'ACTIVE'|'DELETING'|'CREATION_FAILED'|'UPDATE_FAILED'|'DELETION_FAILED'
            },
            'createdAt': datetime(2015, 1, 1),
            'lastModifiedAt': datetime(2015, 1, 1),
            'tags': {
                'string': 'string'
            },
            'statusReason': 'string',
            'source': {
                'eksConfiguration': {
                    'clusterArn': 'string',
                    'securityGroupIds': [
                        'string',
                    ],
                    'subnetIds': [
                        'string',
                    ]
                },
                'vpcConfiguration': {
                    'securityGroupIds': [
                        'string',
                    ],
                    'subnetIds': [
                        'string',
                    ]
                }
            },
            'destination': {
                'ampConfiguration': {
                    'workspaceArn': 'string'
                }
            },
            'roleConfiguration': {
                'sourceRoleArn': 'string',
                'targetRoleArn': 'string'
            }
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    Represents the output of a ListScrapers operation.

    • scrapers (list) --

      A list of ScraperSummary structures giving information about scrapers in the account that match the filters provided.

      • (dict) --

        The ScraperSummary structure contains a summary of the details about one scraper in your account.

        • alias (string) --

          (Optional) A name associated with the scraper.

        • scraperId (string) --

          The ID of the scraper.

        • arn (string) --

          The Amazon Resource Name (ARN) of the scraper.

        • roleArn (string) --

          The Amazon Resource Name (ARN) of the IAM role that provides permissions for the scraper to discover and collect metrics on your behalf.

        • status (dict) --

          A structure that contains the current status of the scraper.

          • statusCode (string) --

            The current status of the scraper.

        • createdAt (datetime) --

          The date and time that the scraper was created.

        • lastModifiedAt (datetime) --

          The date and time that the scraper was last modified.

        • tags (dict) --

          (Optional) The list of tag keys and values associated with the scraper.

          • (string) --

            The key of the tag. Must not begin with aws:.

            • (string) --

              The value of the tag.

        • statusReason (string) --

          If there is a failure, the reason for the failure.

        • source (dict) --

          The Amazon EKS cluster from which the scraper collects metrics.

          • eksConfiguration (dict) --

            The Amazon EKS cluster from which a scraper collects metrics.

            • clusterArn (string) --

              ARN of the Amazon EKS cluster.

            • securityGroupIds (list) --

              A list of the security group IDs for the Amazon EKS cluster VPC configuration.

              • (string) --

                ID of a VPC security group.

            • subnetIds (list) --

              A list of subnet IDs for the Amazon EKS cluster VPC configuration.

              • (string) --

                ID of a VPC subnet.

          • vpcConfiguration (dict) --

            The Amazon VPC configuration for the Prometheus collector when connecting to Amazon MSK clusters. This configuration enables secure, private network connectivity between the collector and your Amazon MSK cluster within your Amazon VPC.

            • securityGroupIds (list) --

              The security group IDs that control network access for the Prometheus collector. These security groups must allow the collector to communicate with your Amazon MSK cluster on the required ports.

              • (string) --

                ID of a VPC security group.

            • subnetIds (list) --

              The subnet IDs where the Prometheus collector will be deployed. The subnets must be in the same Amazon VPC as your Amazon MSK cluster and have network connectivity to the cluster.

              • (string) --

                ID of a VPC subnet.

        • destination (dict) --

          The Amazon Managed Service for Prometheus workspace the scraper sends metrics to.

          • ampConfiguration (dict) --

            The Amazon Managed Service for Prometheus workspace to send metrics to.

            • workspaceArn (string) --

              ARN of the Amazon Managed Service for Prometheus workspace.

        • roleConfiguration (dict) --

          This structure displays information about the IAM roles used for cross-account scraping configuration.

          • sourceRoleArn (string) --

            The Amazon Resource Name (ARN) of the role used in the source account to enable cross-account scraping. For information about the contents of this policy, see Cross-account setup.

          • targetRoleArn (string) --

            The Amazon Resource Name (ARN) of the role used in the target account to enable cross-account scraping. For information about the contents of this policy, see Cross-account setup.

    • nextToken (string) --

      A token indicating that there are more results to retrieve. You can use this token as part of your next ListScrapers operation to retrieve those results.