Event buses and patterns
An EventBridge event busA router that receives events and sends matches to configured destinations. routes JSON eventsA JSON message that describes an occurrence or change., which are messages describing something that happened, to matching targetsA resource or endpoint that receives a matching event.. A target is the resource or endpoint that receives the event. Think of a Classic bus as a sorting desk: rules select events, then send them to the configured destinations.
How it works
- Choose the bus for the producerA system that sends events to an event bus or pipe., the system sending events. The default bus receives AWS service events. A custom Classic bus separates application traffic, and a partner bus receives events from a software as a serviceAn application hosted and operated by a provider for its customers. (SaaS) provider.
- Create a rule with an event patternA JSON filter describing the fields and values an event must match., a JSON filter over fields such as
source,detail-type, anddetail.state. Required fields must exist at the same nesting level. Omitted fields are ignored. - Test the pattern with
TestEventPattern. - Grant permission to invoke each target. A rule can send matches directly to SNS, Lambda, Step Functions, Systems Manager Automation or Run Command, or an ECS task.
- If the target needs a different message shape, use an input transformerA configuration that selects original event values and inserts them into a target message template.. JSONPathA path expression used to select a value in JSON event data., a path expression that selects a JSON value, extracts fields from the original event into a target template.
AWS API calls reach the default bus as AWS API Call via CloudTrail events only when a trail with logging is enabled. Match detail.eventSource and detail.eventName. S3 object calls also need the trail’s data events, and read-only management events need the rule state ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS.
A schemaA description of the structure of an event. describes an event’s structure. Schema discovery infers schemas from the original events, creates a new version when the structure changes, and offers downloadable code bindingsGenerated programming-language code representing an event schema.. An API destinationAn HTTPS endpoint that EventBridge can invoke for a rule or pipe. sends events to an HTTPS endpoint, with a connectionA configuration holding authorization and connectivity settings for an API destination. that holds its authorization.
The Custom Event Bus model uses subscribers instead of rules. Each subscriber filters events, can transform them, and delivers to one target.
Exam cues
- If the question says react when an EC2 instance stops, think a rule on
aws.ec2withEC2 Instance State-change Notificationanddetail.state, because EC2 publishes that state in the event detail. - If the question says catch a specific API call, think
AWS API Call via CloudTrailwitheventSourceandeventName, because those fields sit insidedetailand need an enabled trail. - If the question says email the team when a pipeline fails, think a rule on
CodePipeline Pipeline Execution State Changewith stateFAILEDand an SNS target. - If the question says route GuardDuty or Security Hub findings to remediation, think a finding pattern with a Lambda, Step Functions, or Systems Manager Automation target.
- If the question says reformat an event for a target without code, think an input transformer, because JSONPath variables fill a target template.
- If the question says call a third-party HTTPS API with credentials, think an API destination with a connection, because it holds the authorization.
Remember
- At most five targets per rule.
- API destination requests time out after five seconds, then follow the retry policy.
- Trusted Advisor and Organizations events arrive in US East (N. Virginia). Trusted Advisor’s built-in emails are weekly.
Trap: A rule that matches CloudTrail API calls receives nothing without a trail that has logging enabled, and S3 object calls also need the trail’s data events.
Trap: Schema discovery sees the original event, not the payload an input transformer sends to the target.
A producer sends an event to the bus.
The rule evaluates its event pattern.
EventBridge invokes the authorized target when the event matches.
Da documentação da AWS (37)
- A rule on an event bus compares arriving events with a pattern and sends matching events to its targets.
- The default bus receives AWS service events; custom Classic buses receive application events; partner buses receive SaaS partner events.
- Custom Event Bus - Classic uses rules and targets, while the Custom Event Bus uses subscribers.
- Each Custom Event Bus subscriber filters events, optionally transforms them, and delivers matching events to one target.
- A rule can have at most five targets.
- An event must contain all pattern fields at the same nesting level; fields omitted from the pattern are ignored.
- The prefix operator matches the beginning of a string.
- The numeric operator compares numeric values and ranges.
- The exists operator tests the presence or absence of a leaf field.
- The anything-but operator excludes specified values.
- TestEventPattern tests whether a supplied event matches an event pattern.
- EC2 sends EC2 Instance State-change Notification events with source aws.ec2 and state in detail.state.
- CloudTrail API events use detail-type AWS API Call via CloudTrail on the default bus and require a trail with logging enabled.
- CloudTrail API events expose eventSource and eventName inside detail for rule matching.
- Matching S3 object API calls through CloudTrail requires a trail configured for the relevant data events.
- Read-only CloudTrail management events require rule state ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS; forwarding them requires that state on both forwarding and receiving rules.
- CodePipeline emits CodePipeline Pipeline Execution State Change events, and rules can select FAILED executions and send SNS notifications.
- GuardDuty publishes findings to EventBridge for automated processing and notification.
- Rules can match source aws.securityhub and detail-type Security Hub Findings - Imported and filter finding attributes.
- Rule targets include SNS, Lambda, Step Functions, Systems Manager Automation, Run Command, ECS tasks, and the EBS CreateSnapshot API.
- An EventBridge rule can run a Systems Manager Command document when an Auto Scaling group creates a managed node.
- EventBridge needs permission to invoke the target resource.
- An input transformer extracts values from the original event using JSONPath and inserts them into a template sent to a target.
- A schema describes event structure; EventBridge can infer schemas and generate downloadable code bindings.
- Schema discovery creates a new schema version when event structure changes.
- Schema discovery infers the original event, not the target payload produced by an input transformer.
- An API destination is an HTTPS endpoint used as a rule or pipe target; its connection defines authorization and connectivity.
- API destination requests time out after five seconds and timed-out requests are retried according to the retry policy.
- CodeDeploy sends CodeDeploy Deployment State-change Notification events with source aws.codedeploy.
- Elastic Beanstalk emits environment health transitions and operation state changes for EventBridge response rules.
- Auto Scaling emits successful and unsuccessful scaling events that EventBridge rules can match.
- Trusted Advisor check status changes can trigger EventBridge targets, and those events are emitted in US East (N. Virginia).
- Trusted Advisor built-in email notifications summarize results weekly.
- Trusted Advisor has a low-utilization EC2 instance check for identifying potential cost savings.
- Organizations activity can trigger EventBridge notification rules in US East (N. Virginia).
- Once EventBridge notifications are turned on for a bucket, S3 sends events such as Object Created to EventBridge, where a rule can start a Step Functions workflow.
- EventBridge reaches CloudWatch Logs targets through resource-based policies, Lambda, SNS and SQS targets through a resource-based policy or an IAM execution role, and Kinesis streams through an IAM role.
Scheduler
EventBridge Scheduler invokes a targetA resource or endpoint that receives a matching event. at a chosen time or on a recurring schedule. It supports local time zones and flexible delivery windows, so a job can follow a calendar or run within an acceptable interval.
How it works
-
Choose the schedule expression, text describing when the job runs.
Expression Use Timing rateRegular intervals Without StartDate, begins immediatelycronCalendar-based recurrence Six fields: minutes, hours, day of month, month, day of week, year atOne-time invocation Runs at the specified date and time -
For cronA schedule expression that identifies recurring calendar times. or one-time execution, choose an IANA time zoneA named time zone whose rules define local clock offsets and daylight saving changes., a named set of local clock rules.
-
Set the flexible time window to
OFFor choose a window within which invocation can occur. -
Provide an execution roleAn IAM role that Scheduler assumes to invoke a target on a caller's behalf., an IAM role assumed by
scheduler.amazonaws.com, with permission to call the target. -
Configure retry age, retry count, and a standard SQS DLQA queue that retains events whose delivery failed so they can be processed later. for failed invocations. Grant the execution role permission to send messages to the DLQ.
Legacy scheduled rules use the default event busA router that receives events and sends matches to configured destinations., UTC, and at least one-minute precision. AWS recommends Scheduler for scheduled invocations. An existing rule can directly target the EBS CreateSnapshot API without a Lambda intermediary.
Exam cues
- If the question says run once in a named time zone, think Scheduler with
at, because one-time scheduling and time zones are supported. - If the question says keep the same local daily time, think cron with the local time zone, because a rate day is always 24 hours.
- If the question says distribute jobs within an acceptable interval, think a flexible time window, because Scheduler can spread invocations within it.
- If the question says retain failed scheduled invocations, think a standard SQS DLQ plus execution-role permissions, because Scheduler must deliver the failure there.
Remember
- Types:
rate,cron, andat. - Retry configuration: 60 to 86400 seconds of eventA JSON message that describes an occurrence or change. age and 0 to 185 retries; the first exhausted limit stops retries.
- A rate day is 24 hours, including daylight saving transitions.
- A schedule can pass an input payload to its target.
Trap: A rate day is always 24 hours, so it can shift relative to local wall-clock time when daylight saving time changes.
Da documentação da AWS (12)
- Scheduler supports recurring rate and cron schedules and one-time at schedules.
- Cron and one-time schedules can use an IANA time zone.
- A rate schedule without StartDate begins invoking its target immediately.
- Scheduler cron expressions have six fields: minutes, hours, day of month, month, day of week, and year.
- A day in a rate schedule is a 24-hour duration even across daylight saving changes.
- A flexible time window spreads target invocation within the configured window; choose OFF to disable it.
- Scheduler assumes an execution role trusting scheduler.amazonaws.com to call the target.
- Scheduler retry policy accepts an event age of 60 to 86400 seconds and 0 to 185 retries; retries stop when either limit is reached.
- Scheduler supports a standard SQS DLQ and its execution role needs sqs:SendMessage permission to deliver failed invocations there.
- Scheduled rules are a legacy feature limited to the default bus, use UTC, and have one-minute minimum precision; AWS recommends Scheduler for scheduled target invocation.
- An EventBridge rule can target the EBS CreateSnapshot API directly.
- An EventBridge Scheduler schedule names its target, an execution role and an optional input that it delivers to the target, such as a JSON payload for a Lambda function.
Flashcards
Nada para revisar aqui agora. Escolha outros tópicos ou outro filtro.
·
Todos os 18 flashcards em lista
How does an EventBridge event-bus rule select events and how many targets can it invoke?
It compares event fields with a JSON event pattern and sends matches to up to five targets.
An operations team wants an EventBridge workflow when an EC2 instance stops. What should the rule match?
Match source
aws.ec2, detail-typeEC2 Instance State-change Notification, anddetail.stateequal tostopped; select an authorized response target.An EventBridge rule must detect S3 object API calls through CloudTrail. What logging and event fields are needed?
Enable a trail with the relevant S3 data events. Match
AWS API Call via CloudTrail,detail.eventSource, anddetail.eventNameon the default bus.A team wants EventBridge to route selected GuardDuty or Security Hub CSPM findings to response automation. What should it configure?
Create a finding event pattern and choose an authorized Lambda, Step Functions, or Systems Manager Automation target. Security Hub CSPM finding attributes can narrow the rule.
A team wants an email notification when CodePipeline execution fails. How should EventBridge route the event?
Match
CodePipeline Pipeline Execution State Changewith stateFAILEDand target SNS.Which EventBridge buses receive AWS service, custom application, and SaaS partner events in the Classic rules model?
Default bus for AWS service events, custom Classic bus for application events, and partner bus for SaaS partner events.
An EventBridge target needs a short message containing selected fields from the original event. What avoids a formatting Lambda?
Use an input transformer with JSONPath variables and an input template.
A team wants an Amazon EventBridge rule to start a workflow when an S3 object is created. What should it configure?
Enable EventBridge notifications for the bucket, then create a matching rule with a Step Functions workflow as its target.
An EventBridge rule must call an HTTPS application with configured authorization. Which target fits and what response deadline matters?
Use an API destination with a connection. The endpoint must respond within five seconds or EventBridge times out and applies its retry policy.
An EventBridge rule must launch an ECS task or run a command on a new Auto Scaling managed node. Is a Lambda intermediary required?
No. ECS tasks and Systems Manager Run Command are direct rule targets. Configure target permissions and parameters.
A team needs EventBridge automation on Trusted Advisor status changes sooner than the built-in email summary. What should it configure?
Create rules for Trusted Advisor check status changes in US East (N. Virginia). Built-in summary emails are weekly; a low-utilization EC2 finding can supply a cost-review candidate.
How can every new object in an S3 bucket start a Step Functions workflow without a Lambda function in between?
Turn on EventBridge notifications for the bucket and add an EventBridge rule on Object Created that targets the state machine.
An EventBridge rule targets a Kinesis data stream. Do you grant access with a resource-based policy on the stream?
No. Kinesis targets use an IAM role that EventBridge assumes; resource-based policies are the path for targets such as Lambda, SNS, SQS and CloudWatch Logs.
Which EventBridge feature supports one-time schedules, local time zones, and flexible delivery windows?
EventBridge Scheduler. Use
atfor one-time execution,cronfor calendar schedules, andratefor regular intervals.A team needs a daily EventBridge job at a local wall-clock time across daylight saving changes. Which schedule should it choose?
Use Scheduler with a cron expression and the required IANA time zone. A rate day is always 24 hours and can shift relative to local wall-clock time.
A team needs EventBridge Scheduler failures retained after retries. Which configuration and permissions are needed?
Configure a standard SQS DLQ and give the Scheduler execution role
sqs:SendMessagepermission. The role must also authorize the target invocation.An existing scheduled EventBridge rule must create EBS snapshots without a Lambda function. Which target is available?
Use the built-in EBS
CreateSnapshottarget. Scheduled rules use the default bus and UTC; AWS recommends Scheduler for new scheduled invocations.A Lambda function invoked by Amazon EventBridge Scheduler needs a customer ID on each run. How can the schedule pass it?
Set the schedule target's input; Scheduler delivers that payload to the function.