A healthcare provider runs a legacy patient management portal on Amazon EC2 instances managed by an Auto Scaling group across multiple member accounts in an AWS Organization. The portal's web server writes diagnostic audit logs to `/var/log/portal/audit.log`. The portal uses an automated hourly log rotation utility that renames the active file to `/var/log/portal/audit.log.YYYYMMDD-HH` and creates a new empty `/var/log/portal/audit.log` file. The company must centralize these rotated logs in near real-time into an Amazon S3 bucket located in a dedicated Auditing AWS account. The S3 bucket is configured with default encryption using an AWS Key Management Service (AWS KMS) customer managed key (CMK) to comply with health regulations. The logs must first be captured via CloudWatch Logs in each member account and then streamed to the centralized S3 bucket using Amazon Kinesis Data Firehose. Which two actions should the Solutions Architect take to implement this logging architecture while ensuring operational continuity during log rotation and adhering to the principle of least privilege?
- Configure the CloudWatch agent on the EC2 instances by specifying the file path as `/var/log/portal/audit.log*` in the agent configuration file to ensure both active and rotated logs are collected.Answer
- Configure Kinesis Data Firehose in each member account to deliver logs to the Auditing account's S3 bucket. Update the S3 bucket policy in the Auditing account to grant `s3:PutObject` permissions to the Firehose IAM role ARN from each member account, and update the KMS CMK policy in the Auditing account to grant `kms:GenerateDataKey` permissions to the same roles.Answer
- CConfigure the CloudWatch agent on the EC2 instances by specifying the static file path as `/var/log/portal/audit.log` in the agent configuration file, relying on the agent's file descriptor tracking to capture rotated files.
- DConfigure Kinesis Data Firehose in each member account to write to the S3 bucket using the AWS-managed KMS key `aws/s3` for encryption, and grant the wildcard principal `*` cross-account access via the S3 bucket policy.
- EConfigure the S3 bucket policy in the Auditing account to allow cross-account writes from the member accounts' roles, but omit modifications to the KMS key policy, relying on S3 bucket key encryption to automatically authorize cross-account write requests.