Download the PHP package bitbull/magento2-module-awseventbridge without Composer
On this page you can find all versions of the php package bitbull/magento2-module-awseventbridge. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bitbull/magento2-module-awseventbridge
More information about bitbull/magento2-module-awseventbridge
Files in bitbull/magento2-module-awseventbridge
Package magento2-module-awseventbridge
Short Description Magento 2 module for AWS EventBridge integration.
License MIT
Informations about the package magento2-module-awseventbridge
Amazon EventBridge integration module for Magento 2
Send Magento events to Amazon EventBridge service to be able to integrate Magento with many different AWS serverless services.
Contents
- Installation instructions
- IAM permissions required
- Setup
- Credentials
- Options
- Events
- Enable events
- Create an AWS EventBridge Rule
- Data specification
- Supported Events
- Debug and local testing
- Contributing
Installation instructions
Install this module using composer:
Execute Magento 2 Setup Upgrade:
IAM permissions required
Create a new IAM Policy with these content:
change events:source
according to your module configuration.
read more about IAM permissions at:
- https://docs.aws.amazon.com/en_us/AmazonCloudWatch/latest/events/auth-and-access-control-cwe.html
- https://docs.aws.amazon.com/en_us/AmazonCloudWatch/latest/events/policy-keys-cwe.html
If you are using EC2 instance add this policy to attached IAM Role.
read more about using IAM Role with EC2 at:
If your are running Magento locally, on-premises or with an other Cloud Provider different from AWS follow these steps:
- Create a new AWS IAM User
- Attach the created policy
- Generate access keys for the user
read more about creating IAM users at:
- https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_change-permissions.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html
Setup
Go to "Stores" > "Configuration" > "Services" > "AWS EventBridge", then start configuring this module.
Credentials
You can set your access keys for IAM Users:
Retrieving from environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY:
Using EC2 Instance Role:
Options
Edit module options:
- Set the correct region where you want to receive events, for example "eu-west-1".
- Set event source name with a value that can be filtered (
events:source
) when you connect to these events. - Set event bus name, leave empty to use your account default.
- Enable tracking to add
tracking
property to data object. - Enable debug mode if you want a more verbose logging in
var/log/aws-eventbridge.log
log file. - Enable CloudWatch Events fallback to use this service instead of EventBridge (for backward compatibility).
- Enable dry run mode to activate the module actions and integrations without actually sending events data.
- Enable Queue mode to send events asynchronously using Magento queue instead of real-time (only available on Magento Enterprise edition).
If you enable the "Queue mode" you also need to enable cron consumer runner into your env.php
N.B. cron events are always executed synchronously without using queue.
Events
This module inject observers to listen to Magento 2 events, elaborate the payload and then send the event to AWS services.
Enable events
These option sections contain a list of supported events that can be activated and used to trigger Lambda functions, send event to an SNS topic, add message to SQS Queue, execute a StepFunction and so on. Enable events you want to receive to be able to trigger your EventBridge Rules.
Create an AWS EventBridge Rule
In order to connect to an EventBridge event and trigger a target you need to create an EventBridge Rule that match one or more events.
The event name is used in detail-type
section of event data, so if you want to match "CartProductAdded" event you need to create a rule like this:
remember to also match source
name to avoid collision with different Magento environment.
You can also match multiple event names, for example if you want to react to all cart events:
Is it possible to use a more specific matching rule in order to match, for example, all cart events related to a specific product sku:
read more about content-based filtering with Event Patterns at:
Data specification
Event will be pass data into Details
event property:
Every event has a metadata
property that contain date, timestamp and process mode of the event:
Additionally (activating tracking option in backend options) every event will be enriched with tracking
property that contain infos about client, session and framework, for example:
when using Magento CLI user
is based on the system user that execute the command:
Supported Events
Here a list of supported events that can be enabled:
Cart events
CartProductAdded
A product is added to cart by a customer.
CartProductUpdated
A cart is updated by a customer.
CartProductRemoved
A product is removed from cart by a customer.
Admin user events
UserLoggedIn
An admin user logged in.
UserLoggedOut
An admin user logged out.
UserLoginFailed
An admin user failed login.
Customers events
CustomerLoggedIn
A customer user logged in.
CustomerLoggedOut
A customer user logged out.
CustomerLoginFailed
A customer user failed login.
CustomerSignedUp
A customer user sign up.
CustomerSignedUpFailed
A customer user failed sign up.
Newsletter events
NewsletterSubscriptionChanged
A customer user change newsletter subscription preference.
Order events
OrderPlaced
An new order was placed.
OrderCreated
/ OrderUpdated
An order was created or updated.
OrderCanceled
An order was canceled.
OrderDeleted
An order was deleted.
Invoice events
InvoiceCreated
/ InvoiceUpdated
An invoice was created or updated.
InvoicePayed
An invoice was payed.
InvoiceRegistered
An invoice was registered.
OrderDeleted
An invoice was deleted.
Credit Memo events
CreditmemoCreated
/ CreditmemoUpdated
A credit memo was created or updated.
CreditmemoRefunded
A credit memo was refunded.
CreditmemoDeleted
A credit memo was deleted.
Shipment events
ShipmentSaved
A shipment was saved.
ShipmentDeleted
A shipment was deleted.
Cache events
CacheFlushAll
An admin user flush the cache.
CacheFlushSystem
An admin user flush system cache.
CacheFlushCatalogImages
An admin user flush catalog images cache.
CacheFlushMedia
An admin user flush media cache.
CacheFlushStaticFiles
An admin user flush static files cache.
Indexer events
StateSaved
An index change state.
Debug and local testing
Module log are written in var/log/aws-eventbridge.log
log file.
Enable "debug mode" option to increase logging level and retrieve more details about module operations.
Enable "dry run mode" to test module without configuring credentials. This options skip AWS API call and allow you to test locally without need a AWS Account.
Contributing
Any help is appreciated. If you want to contribute first read the contribution guide.