A global retail company runs its checkout application on Amazon EC2 instances in an Auto Scaling group across multiple member accounts in an organization in AWS Organizations. The application writes transaction logs to `/var/log/checkout/app.log`. The application server rotates logs hourly, renaming the active log file to `/var/log/checkout/app.log.1` (and shifting older logs to `app.log.2`, `app.log.3`, etc.) while creating a new `app.log` file.
The company wants to centralize these logs into an Amazon S3 bucket located in a dedicated Security account. The architecture must stream logs from the EC2 instances to CloudWatch Logs, and then forward them to the centralized S3 bucket via Amazon Kinesis Data Firehose. The solution must handle hourly log rotations without log loss and enforce least-privilege cross-account access.
Which two actions should a solutions architect take to meet these requirements? (Select TWO.)
- In the Unified CloudWatch Agent configuration file on the EC2 instances, configure the logs section with "file_path": "/var/log/checkout/app.log*" to monitor the log files.Answer
- BIn the Unified CloudWatch Agent configuration file on the EC2 instances, configure the logs section with "file_path": "/var/log/checkout/app.log" and enable the "auto_reopen_on_rotate": true setting.
- Configure the S3 bucket policy in the Security account to grant s3:PutObject and s3:PutObjectAcl permissions to the IAM roles assumed by the Kinesis Data Firehose delivery streams in the member accounts, using the aws:PrincipalOrgID condition key to restrict access to the organization.Answer
- DConfigure the S3 bucket policy in the Security account to allow s3:PutObject actions for the principal "*", and apply a Service Control Policy (SCP) at the organizational root level that allows the member accounts' Kinesis Data Firehose IAM roles to write to the Security account's S3 bucket.
- EIn the Unified CloudWatch Agent configuration file on the EC2 instances, configure the logs section with "file_path": "/var/log/checkout/app.log" and configure a pre-rotation script on the EC2 instances that restarts the CloudWatch Agent service immediately after the log rotation occurs.