A developer has deployed a Python Flask web application on Amazon EC2 instances. The application receives user requests, sends notifications to Amazon SNS, and queries an Amazon RDS PostgreSQL database. The AWS X-Ray daemon is running on the instances and has the necessary permissions. However, the X-Ray service map only shows the EC2 instances as nodes and does not display downstream nodes for Amazon SNS or the RDS database. Which two actions should the developer take to instrument the application and trace these downstream components? (Select TWO.)
- Call the patch_all() function from the aws_xray_sdk.core module at the start of the application to instrument boto3.Answer
- Use the database patching capabilities in the AWS X-Ray SDK to instrument the psycopg2 database connector.Answer
- CHardcode AWS credentials with the AWSXRayDaemonWriteAccess policy in the application's initialization code.
- DIncrease the visibility timeout of the downstream Amazon SQS queue to match the database connection timeout.
- ERefactor the application's routing to parse incoming JSON payloads as API Gateway Lambda proxy integration events.
Answer
To instrument downstream calls, the developer must call the patch_all() function from the X-Ray SDK to instrument boto3 and patch the database connector (psycopg2) to trace RDS queries.
The correct choices involve using the AWS X-Ray SDK to patch the boto3 library and instrument the database connector (psycopg2). This allows the SDK to intercept and record tracing data for downstream services like Amazon SNS and Amazon RDS.
Step-by-Step Solution
Key Concept
AWS X-Ray SDK patching and instrumentation for downstream service and database calls.