AWS Certified DevOps Engineer – Professional
CloudWatch Logs subscription filters and cross-account delivery A subscription filter sends matching log events from a log group to Amazon Kinesis Data Streams, Amazon Data Firehose, AWS Lambda or Amazon OpenSearch Service. The CloudWatch Logs User Guide says cross-account delivery goes through a CloudWatch Logs destination that the recipient account creates, with an access policy naming who may send to it.
How is each subscription target authorized? For a Kinesis data stream, you create an IAM role that CloudWatch Logs assumes, with a permissions policy that lets it put data into the stream. The role's ARN is passed with --role-arn when the subscription filter is created.
For a Lambda function there is no role on the filter. The function's own policy must allow the principal logs.amazonaws.com to call lambda:InvokeFunction, which aws lambda add-permission sets up with the log group as the source ARN.
Data sent through a subscription filter is compressed with gzip. Lambda receives it base64 encoded in the awslogs.data field. Kinesis records hold the gzip bytes.
How does cross-account delivery work? The recipient account creates a destination. A destination has a name, a target ARN such as a Kinesis data stream, a role ARN that lets CloudWatch Logs put data into that stream, and an access policy that sets who is allowed to write to the destination. The recipient then shares the destination's ARN with the sender.
The sender account creates a subscription filter on its log group that points at the destination. The sender can be a single account or a whole organization. When the policy admits an organization, each sender account still needs its own subscription filter.
The log group and the destination must be in the same Region. The resource that the destination points to can be in a different Region.
What happens when the stream is throttled? If a Kinesis data stream does not have enough shards for the log volume, delivery is throttled. Throttled deliveries are retried for up to 24 hours. After 24 hours the failed deliveries are dropped.
AWS lists four ways to reduce the risk. Set distribution to random on the filter, because the default distributes by log stream. Watch the DeliveryThrottling metric. Use on-demand capacity mode for the stream. Narrow the filter pattern to match the capacity of the stream.
Where the exam catches people Believing a Lambda target needs a role on the subscription filter: Lambda is authorized by a resource-based permission for logs.amazonaws.com. Roles are for stream targets. Believing the destination must be in the same Region as the stream: the destination must be in the same Region as the log group. The stream can be elsewhere. Believing an organization-wide access policy creates the subscriptions: every sender account must still create its own subscription filter. Believing throttled log deliveries are retried until they succeed: they are retried for up to 24 hours and then dropped. Believing the sender account owns the destination: the recipient creates the destination and its role, and shares the ARN. Written from these sources Try 3 questions on this Pick an answer to see why each option is right or wrong.
A DevOps team manages an Amazon CloudWatch Logs log group named /orders/app with an AWS CloudFormation template. The template must add two subscription filters to the log group. One sends every event to an Amazon Data Firehose stream that delivers to Amazon S3. The other sends ERROR events to an AWS Lambda function that opens tickets. The stream, the function and the log group are in the same account and Region. Company policy requires every grant to be scoped to this log group, this stream or this function.
Which combination of steps will meet these requirements? (Select TWO.) Right. In the game that’s Renown for your Monitoring and Logging building.
Not that one: C,D is right. In the game your Monitoring and Logging building would lose a little Renown, and this question would come back later.
Your answer A. Create an IAM role that trusts the CloudWatch Logs service principal and allows lambda:InvokeFunction on the function, and set it as the RoleArn of the Lambda subscription filter.The Lambda subscription filter does not use a role, so this role is never assumed and the function's policy still does not allow CloudWatch Logs to invoke it. Delivery to the function would fail. Your answer B. Add a statement to the function's execution role that allows the CloudWatch Logs service principal to call lambda:InvokeFunction on the function, with the log group's ARN as the source.An execution role controls what the function can do, not who can call it. CloudWatch Logs would still be refused when it tried to invoke the function. Your answer C. Create an IAM role that trusts the CloudWatch Logs service principal and allows firehose:PutRecord and firehose:PutRecordBatch on the stream, and set it as the RoleArn of the Firehose subscription filter.Your answer D. Create an AWS::Lambda::Permission resource that allows the CloudWatch Logs service principal to call lambda:InvokeFunction on the function, with the log group's ARN as the SourceArn.Your answer E. Create an IAM role that trusts the CloudWatch Logs service principal and allows firehose:PutRecord and firehose:PutRecordBatch on the stream, and set it as the stream's own role for delivery to Amazon S3.The stream's delivery role is what Firehose uses to write to Amazon S3. CloudWatch Logs only uses a role that is passed in the subscription filter, so the filter still has no way to put records into the stream.
Show the full explanation and doc quotes For a Lambda target there is no role: the function itself must allow CloudWatch Logs to invoke it through a resource-based policy, which in CloudFormation is an AWS::Lambda::Permission with lambda:InvokeFunction and the log group's ARN as the source ARN. Both grants stay scoped to this stream, function and log group.
Written from docs.aws.amazon.com/AmazonCloudWatch/latest/logs/SubscriptionFilters.html
A company acquired a business that runs its applications in four AWS accounts. The four accounts are not part of the company's organization in AWS Organizations and will stay separate for two years. Each account writes application events to an Amazon CloudWatch Logs log group named /app/events in eu-west-1. The company's security account runs an intrusion detection application that reads one Amazon Kinesis Data Streams data stream in eu-west-1. New events from all four log groups must reach that stream within minutes.
Which combination of steps should the DevOps engineer take to meet these requirements? (Select THREE.) Right. In the game that’s Renown for your Monitoring and Logging building.
Not that one: A,C,F is right. In the game your Monitoring and Logging building would lose a little Renown, and this question would come back later.
Your answer A. In the security account, create an IAM role that the CloudWatch Logs service principal can assume, with permission to call kinesis:PutRecord on the stream.Your answer B. In each of the four acquired accounts, create a CloudWatch Logs destination that targets the stream in the security account, and attach an access policy that allows the security account ID to call logs:PutSubscriptionFilter.A destination belongs to the account that receives the logs. Destinations created in the acquired accounts put the receiving side in the wrong place, and the security account's stream is never wrapped by a destination it owns. Your answer C. In the security account, create a CloudWatch Logs destination that targets the stream, and attach an access policy that allows the four acquired account IDs to call logs:PutSubscriptionFilter.Your answer D. In each acquired account, create a subscription filter on the /app/events log group that sends events to the ARN of the destination in that same account.A subscription filter uses a destination only for delivery to a different account. A destination in the filter's own account is not a valid target, so each filter has to name the security account's destination ARN. Your answer E. In each acquired account, create an IAM role that the CloudWatch Logs service principal can assume, with permission to call kinesis:PutRecord on the stream in the security account.A role in an acquired account cannot be the one that writes into the security account's stream. The destination in the security account carries the role CloudWatch Logs uses for delivery, so this role would never be used. Your answer F. In each acquired account, create a subscription filter on the /app/events log group that sends events to the ARN of the destination in the security account.
Show the full explanation and doc quotes Because the four acquired accounts are outside the organization, the destination's access policy names their four account IDs and allows them to call logs:PutSubscriptionFilter on it. Each acquired account then creates its own subscription filter on /app/events and points it at the destination ARN. CloudWatch Logs forwards matching events soon after ingestion, usually within three minutes.
Written from docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CrossAccountSubscriptions-Kinesis.html
A company has 30 accounts in AWS Organizations with workloads in us-east-1 and eu-west-1. In every account and Region, a subscription filter on the /app/audit log group sends events to an Amazon CloudWatch Logs destination in a central account. The central account has one destination in us-east-1 and one in eu-west-1, and both target an Amazon Kinesis Data Streams data stream in us-east-1. A new data residency rule requires the stream that stores the audit events to move to eu-central-1. The log groups stay where they are.
Which solution will meet these requirements? Right. In the game that’s Renown for your Monitoring and Logging building.
Not that one: A is right. In the game your Monitoring and Logging building would lose a little Renown, and this question would come back later.
The answer A. Create the new stream in eu-central-1. Keep the two destinations in us-east-1 and eu-west-1, update each one to target the new stream, and let the destinations' IAM role put records into the new stream.A CloudWatch Logs destination has to sit in the same Region as the log groups that send to it, but the stream it points to can be in any Region. Your answer B. Create the new stream in eu-central-1. Keep the two destinations in us-east-1 and eu-west-1, update each one's access policy to name the new stream, and let the member accounts put records into the new stream.The access policy only controls which accounts may create subscription filters against the destination. Naming the stream there changes nothing about delivery, and the member accounts never write to the stream themselves. Your answer C. Create the new stream in eu-central-1. Create two destinations in eu-central-1 that target the new stream, one for each source Region, and update each subscription filter to send to the matching new destination.Having one destination per source Region is the right idea, but both are created in eu-central-1. The log groups stay in their own Regions, so neither set of filters can point at them. Your answer D. Create the new stream in eu-central-1. Create one destination in eu-central-1 that targets the new stream, and update the subscription filter in every account and Region to send to the new destination.A subscription filter in us-east-1 or eu-west-1 cannot use a destination in eu-central-1, because the destination must be in the log group's Region. The update to every filter would fail.
Show the full explanation and doc quotes So the two existing destinations stay in us-east-1 and eu-west-1, and only what they point at changes. PutDestination both creates and updates a destination, so the central account updates each one with the new stream in eu-central-1 as its target, and gives the role that the destinations pass to CloudWatch Logs permission to put records into that stream. The destination ARNs do not change, so the subscription filters in the 30 accounts keep working untouched.
Written from docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CrossAccountSubscriptions.html
Related Certopolis is an independent study game. It is not affiliated with, endorsed by or sponsored by Amazon Web Services, and its questions are not the exams' questions. Exam names are trademarks of their owners. Questions are AI-written from each exam's public guide and vendor docs and may contain errors. Terms · Privacy