Monitoring AWS API Gateway

The AWS API Gateway sensor is automatically deployed and installed after you install the Instana agent.

For other supported AWS services, see the AWS topic.

There are three types of APIs (REST, HTTP, and WebSocket) and metrics that are retrieved are also based on them.

Sensor (data collection)

Tracked configuration

The following API Gateway details are collected by the AWS API Gateway sensor:

  • ARN
  • Name
  • Region
  • Protocol
  • Endpoint Type
  • Created At
  • AWS Grouping Zone

Metrics

The following metrics are collected by the AWS API Gateway sensor:

REST API

Name Description
API Requests (Count) The total number API requests in a given period.
Total Latency The time between when API Gateway receives a request from a client and when it returns a response to the client. The latency includes the integration latency and other API Gateway overhead.
Integration Latency The time between when API Gateway relays a request to the backend and when it receives a response from the backend.
4xx Errors The number of client-side errors captured in a given period.
5xx Errors The number of server-side errors captured in a given period.
Cache Hit (Count) The number of requests served from the API cache in a given period.
Cache Miss (Count) The number of requests served from the backend in a given period, when API caching is enabled.

HTTP API

Name Description
API Requests (Count) The total number API requests in a given period.
Total Latency The time between when API Gateway receives a request from a client and when it returns a response to the client. The latency includes the integration latency and other API Gateway overhead.
Integration Latency The time between when API Gateway relays a request to the backend and when it receives a response from the backend.
4xx Errors The number of client-side errors captured in a given period.
5xx Errors The number of server-side errors captured in a given period.

WebSocket API

Name Description
Connect (Count) The number of messages sent to the $connect route integration.
Message (Count) The number of messages sent to the WebSocket API, either from or to the client.
Integration Errors The number of requests that return a 4XX/5XX response from the integration.
Client Errors The number of requests that have a 4XX response returned by API Gateway before the integration is invoked.
Execution Errors Errors that occurred when calling the integration.
Integration Latency The time between when API Gateway relays a request to the backend and when it receives a response from the backend.

Required permissions

The following permissions are required:

  • cloudwatch:GetMetricData
  • cloudwatch:GetMetricStatistics
  • cloudwatch:ListMetrics
  • apigateway:GET

Configuration

Metrics for API Gateway are pulled every 60 seconds, which can be changed by using the agent configuration in the <agent_install_dir>/etc/instana/configuration.yml file:

com.instana.plugin.aws.apigateway:
  cloudwatch_period: 60

To disable monitoring of API Gateway instances, use the following configuration:

com.instana.plugin.aws.apigateway:
  enabled: false

Proxy configuration

To make the specific AWS sensor use the proxy configuration, add the following agent configuration settings:

com.instana.plugin.aws.apigateway:
  proxy_host: 'example.com' # proxy host name or ip address
  proxy_port: 3128 # proxy port
  proxy_protocol: 'HTTP' # proxy protocol: HTTP or HTTPS
  proxy_username: 'username' # OPTIONAL: proxy username
  proxy_password: 'password' # OPTIONAL: proxy password

Monitoring multiple AWS accounts

To set up monitoring of multiple AWS accounts with one AWS agent in the same region, see the Monitoring multiple AWS accounts topic.

AWS-named profiles approach

To override which profiles are used to monitor API Gateway, use the following configuration:

com.instana.plugin.aws.apigateway:
  profile_names:
    - 'profile2'
    - 'profile3'

If you define profiles on service level, the global AWS profiles configuration will be overridden.

AWS STS approach

To override which IAM roles are used to monitor API Gateway, use the following configuration:

com.instana.plugin.aws.apigateway:
  role_arns:
    - 'arn:aws:iam::<account_1_id>:role/<role_1_name>'
    - 'arn:aws:iam::<account_2_id>:role/<role_2_name>'

If you define IAM roles on service level, the global AWS IAM roles configuration will be overriden.

Filtering

You can define multiple tags, which are separated by a comma. Tags need to provided as a key-value pair. To make configuration easier, you can define which tags you want to include in discovery or exclude from discovery. If you define tag in both lists (include and exclude), the exclude list has higher priority. If you don't need to filter services, you don't need to define the tags. It’s not mandatory to define all values to enable filtering.

You can specify how often sensors poll the AWS tagged resources by using the tagged-services-poll-rate configuration property. By default, the value is 300 seconds.

Tags are only available with the AWS Agent.

To define how often sensors poll the tagged resources, use the following configuration:

com.instana.plugin.aws:
  tagged-services-poll-rate: 60 #default 300

To include services by tags into discovery, use the following configuration:

com.instana.plugin.aws.apigateway:
  include_tags: # Comma separated list of tags in key:value format (e.g. env:prod,env:staging)

To exclude services by tags from discovery, use the following configuration:

com.instana.plugin.aws.apigateway:
  exclude_tags: # Comma separated list of tags in key:value format (e.g. env:dev,env:test)

AWS services without tags are monitored by default, but can be excluded by setting the include_untagged field to false:

com.instana.plugin.aws.apigateway:
  include_untagged: false # True value by default