AWS Certified Developer – Associate — Question 389
A developer must use AWS X-Ray to monitor an application that is running on an Amazon EC2 instance. The developer has prepared the application by using the
X-Ray SDK.
What should the developer do to perform the monitoring?
Answer options
- A. Configure the X-Ray SDK sampling rule and target. Activate the X-Ray daemon from the EC2 console or the AWS CLI with the modify-instance-attribute command to set the XRayEnabled flag.
- B. Install the X-Ray daemon. Assign an IAM role to the EC2 instance with a policy that allows writes to X-Ray.
- C. Install the X-Ray daemon. Configure it to forward data to Amazon EventBridge (Amazon CloudWatch Events). Grant the EC2 instance permission to write to Event Bridge (CloudWatch Events).
- D. Deploy the X-Ray SDK with the application, and instrument the application code. Use the SDK logger to capture and send the events.
Correct answer: B
Explanation
To successfully transmit trace data from an Amazon EC2 instance to AWS X-Ray, the X-Ray daemon must be installed and running on the instance to collect data from the X-Ray SDK. Additionally, the EC2 instance must be associated with an IAM role containing permissions (such as the AWSXRayDaemonWriteAccess policy) to upload this data to the X-Ray service. Other options are incorrect because there is no XRayEnabled attribute for EC2 instances, and X-Ray trace data is sent directly to the X-Ray API via the daemon rather than through Amazon EventBridge.