Skip to content

AppSync Tracing

Level: Warning

Initial version: 0.1.3

cfn-lint: WS3000

tflint: aws_appsync_graphql_api_tracing_rule

AWS AppSync can emit traces to AWS X-Ray, which enables visualizing service maps for faster troubleshooting.

Why is this a warning?

You might use third party solutions for monitoring serverless applications. If this is the case, enabling tracing for AppSync APIs might be optional. Refer to the documentation of your monitoring solutions to see if you should enable AWS X-Ray tracing or not.

Implementations

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
import { GraphqlApi } from '@aws-cdk/aws-appsync';

export class MyStack extends cdk.Stack {
  constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    const myApi = new GraphqlApi(
      scope, 'MyApi',
      {
        name: 'my-api',
        // Enable active tracing
        xrayEnabled: true,
      }
    );
  }
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
{
  "Resources": {
    "GraphQLApi": {
    "Type": "AWS::AppSync::GraphQLApi",
    "Properties": {
      "Name": "api",
      "AuthenticationType": "AWS_IAM",

      // Enable active tracing
      "XrayEnabled": true
    }
    }
  }
}
1
2
3
4
5
6
7
8
9
Resources:
  GraphQLApi:
    Type: AWS::AppSync::GraphQLApi
    Properties:
      Name: api
      AuthenticationType: AWS_IAM

      # Enable active tracing
      XrayEnabled: true
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
resources:
  Resources:
    GraphQLApi:
      Type: AWS::AppSync::GraphQLApi
      Properties:
        Name: api
        AuthenticationType: AWS_IAM

        # Enable active tracing
        XrayEnabled: true
1
2
3
4
5
6
7
resource "aws_appsync_graphql_api" "this" {
  name                = "api"
  authentication_type = "AWS_IAM"

  # Enable active tracing
  xray_enabled = true
}

See also