Type
magento2-module
Magento 2 module for AWS EventBridge integration.
magento2-module
MIT
None
None
None
None
None
Event bridge to send Magento 2 events as AWS CloudWatch Events to be able to connect many different AWS serverless services.
Install this module using composer:
composer require bitbull/magento2-module-awseventbridge
If you are using EC2 instance add these permission to your IAM policy, otherwise, create a new user and attach a new policy with these required permissions:
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"events:PutEvents"
],
"Effect": "Allow",
"Resource": "*",
"Condition": {
"StringEquals": {
"events:source": "example.com"
}
}
}
]
}
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
Go to "Stores" > "Configuration" > "Services" > "AWS EventBridge", then start configuring the credentials section:
events:source
) when you connect to these events.tracking
property to data object.var/log/aws-eventbridge.log
log file.These sections contain a list of supported events that can be activated and used to trigger Lambda functions.
Event will be pass data into Details
event property:
(
[sku] => WJ12-S-Blue
[qty] => 1
[tracking] => Array
(
[transport] => HTTP
[hostname] => f3a501ad4988
[time] => 1566821650383
)
)
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:
[tracking] => Array
(
[transport] => HTTP
[hostname] => f3a501ad4988
[time] => 1566594699836
[storeId] => 1
[version] => Array
(
[module] => dev-master
[php] => 7.1.27-1+ubuntu16.04.1+deb.sury.org+1
[magento] => 2.2.7
)
[user] => Array
(
[id] => 3
[username] => fabio.gollinucci
[email] => [email protected]
)
[ip] => 172.17.0.1
[userAgent] => Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0
)
when using Magento CLI user
is based on the system user that execute the command:
[tracking] => Array
(
[transport] => SHELL
[hostname] => f3a501ad4988
[time] => 1566821355758
[storeId] => 1
[version] => Array
(
[module] => dev-master
[php] => 7.1.27-1+ubuntu16.04.1+deb.sury.org+1
[magento] => 2.2.7
)
[user] => Array
(
[name] => www-data
[passwd] => x
[uid] => 1000
[gid] => 33
[gecos] => www-data
[dir] => /var/www
[shell] => /usr/sbin/nologin
)
)
Here a list of supported events that can be enabled:
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
UserLoggedIn
An admin user logged in
UserLoggedOut
An admin user logged out
UserLoginFailed
An admin user failed login
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
NewsletterSubscriptionChanged
A customer user change newsletter subscription preference
OrderPlaced
A customer place a new order
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