2022-10-21 10:23:10 -06:00
# EventBridge code examples for the SDK for Ruby
2023-05-19 13:23:56 -06:00
2022-10-21 10:23:10 -06:00
## Overview
2021-10-13 16:38:58 +01:00
2023-05-19 13:23:56 -06:00
Shows how to use the AWS SDK for Ruby to work with Amazon EventBridge.
<!--custom.overview.start-->
<!--custom.overview.end-->
2024-01-04 13:25:48 -05:00
_ EventBridge is a serverless event bus service that makes it easy to connect your applications with data from a variety of sources. _
2023-05-19 13:23:56 -06:00
## ⚠ Important
2021-10-13 16:38:58 +01:00
2024-01-04 13:25:48 -05:00
* Running this code might result in charges to your AWS account. For more details, see [AWS Pricing ](https://aws.amazon.com/pricing/ ) and [Free Tier ](https://aws.amazon.com/free/ ).
2022-10-21 10:23:10 -06:00
* Running the tests might result in charges to your AWS account.
2023-05-19 13:23:56 -06:00
* We recommend that you grant your code least privilege. At most, grant only the minimum permissions required to perform the task. For more information, see [Grant least privilege ](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege ).
2022-10-21 10:23:10 -06:00
* This code is not tested in every AWS Region. For more information, see [AWS Regional Services ](https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services ).
2021-10-13 16:38:58 +01:00
2023-05-19 13:23:56 -06:00
<!--custom.important.start-->
<!--custom.important.end-->
2021-10-13 16:38:58 +01:00
## Code examples
2023-05-19 13:23:56 -06:00
### Prerequisites
2021-10-13 16:38:58 +01:00
2023-05-19 13:23:56 -06:00
For prerequisites, see the [README ](../../README.md#Prerequisites ) in the `ruby` folder.
2021-10-13 16:38:58 +01:00
2023-05-19 13:23:56 -06:00
<!--custom.prerequisites.start-->
<!--custom.prerequisites.end-->
2022-10-21 10:23:10 -06:00
### Scenarios
2023-05-19 13:23:56 -06:00
Code examples that show you how to accomplish a specific task by calling multiple
functions within the same service.
2022-10-21 10:23:10 -06:00
2024-01-04 13:25:48 -05:00
- [Create and trigger a rule ](cw-ruby-example-send-events-ec2.rb )
<!--custom.examples.start-->
<!--custom.examples.end-->
2022-10-21 10:23:10 -06:00
2023-05-19 13:23:56 -06:00
## Run the examples
2022-10-21 10:23:10 -06:00
2023-05-19 13:23:56 -06:00
### Instructions
2022-10-21 10:23:10 -06:00
2023-05-19 13:23:56 -06:00
<!--custom.instructions.start-->
The quickest way to interact with this example code is to invoke a [Scenario ](#Scenarios ) from your command line. For example, `ruby some_scenario.rb` will invoke `some_scenario.rb` .
<!--custom.instructions.end-->
2021-10-13 16:38:58 +01:00
2022-10-21 10:23:10 -06:00
2023-05-19 13:23:56 -06:00
#### Create and trigger a rule
This example shows you how to create and trigger a rule in Amazon EventBridge.
2022-10-21 10:23:10 -06:00
2023-05-19 13:23:56 -06:00
<!--custom.scenario_prereqs.eventbridge_Scenario_createAndTriggerARule.start-->
<!--custom.scenario_prereqs.eventbridge_Scenario_createAndTriggerARule.end-->
Start the example by running the following at a command prompt:
```
ruby cw-ruby-example-send-events-ec2.rb
```
<!--custom.scenarios.eventbridge_Scenario_createAndTriggerARule.start-->
<!--custom.scenarios.eventbridge_Scenario_createAndTriggerARule.end-->
2022-10-21 10:23:10 -06:00
### Tests
2023-05-19 13:23:56 -06:00
⚠ Running tests might result in charges to your AWS account.
To find instructions for running these tests, see the [README ](../../README.md#Tests )
in the `ruby` folder.
<!--custom.tests.start-->
## Contribute
Code examples thrive on community contribution.
To learn more about the contributing process, see [CONTRIBUTING.md ](../../../CONTRIBUTING.md ).
<!--custom.tests.end-->
2022-10-21 10:23:10 -06:00
## Additional resources
2024-01-04 13:25:48 -05:00
- [EventBridge User Guide ](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-what-is.html )
- [EventBridge API Reference ](https://docs.aws.amazon.com/eventbridge/latest/APIReference/Welcome.html )
- [SDK for Ruby EventBridge reference ](https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/Eventbridge.html )
2023-05-19 13:23:56 -06:00
<!--custom.resources.start-->
<!--custom.resources.end-->
---
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2022-10-21 10:23:10 -06:00
2024-01-04 13:25:48 -05:00
SPDX-License-Identifier: Apache-2.0