Laravel AWS SNS Events
7.x
7.x
  • โšกIntroduction
  • ๐ŸŽ‰Support
  • Getting Started
    • โฌ†๏ธUpgrading from 6.x
    • ๐Ÿš€Installation
    • ๐Ÿ“กConfiguring Events
    • ๐ŸงชTesting your implementation
  • Customization
    • ๐Ÿ“ฆCustom Payload
    • ๐ŸคฟCustom Event Classes
    • ๐Ÿ”—Custom Method Hooks
  • AWS Webhooks
    • โšกIntroduction
    • ๐Ÿš€Installation
    • ๐Ÿ™ŒShowcase
    • ๐Ÿ–ฅ๏ธSupported AWS Services
      • ๐ŸšจCloudWatch Alerts
      • ๐Ÿ“งSimple Email Service (SES)
      • ๐ŸŒ‰EventBridge Events
    • ๐ŸงชTesting your implementation
Powered by GitBook
On this page

Was this helpful?

  1. AWS Webhooks
  2. Supported AWS Services

EventBridge Events

EventBridge is supported for all aws.* sources coming within the message payload. You can implement your own methods just by creating a method similar to on[source_name]Event.

For example, you might have this EC2 Spot Termination notice:

{
   "id":"7bf73129-1428-4cd3-a780-95db273d1602",
   "detail-type":"EC2 Instance State-change Notification",
   "source":"aws.ec2",
   "account":"123456789012",
   "time":"2015-11-11T21:29:54Z",
   "region":"us-east-1",
   "resources":[
      "arn:aws:ec2:us-east-1:123456789012:instance/i-abcd1111"
   ],
   "detail":{
      "instance-id":"i-abcd1111",
      "state":"pending"
   }
}

Because the source is called aws.ec2, you should create an onEc2Event method within your extended class:

use RenokiCo\AwsWebhooks\Http\Controllers\EventbridgeWebhook;

class MyEventbridgeController extends EventbridgeWebhook
{
    /**
     * Handle the EC2 events.
     *
     * @param  array  $message
     * @param  array  $originalMessage
     * @param  \Illuminate\Http\Request  $request
     * @return void
     */
    protected function onEc2Event(array $message, array $originalMessage, Request $request)
    {
        foreach ($message['resources'] as $instanceArn) {
            //
        }
    }
}
PreviousSimple Email Service (SES)NextTesting your implementation

Last updated 3 years ago

Was this helpful?

๐Ÿ–ฅ๏ธ
๐ŸŒ‰