Open9

AWS Lambdaに渡されるEventのサンプル

sinofsevensinofseven

SNS -> SQS -> Lambda

{
  "Records": [
    {
      "messageId": "e189d163-fa4b-4a80-a807-ec10841d5f43",
      "receiptHandle": "AQEBvw7RaEhpDwUimpWuUXJm2yCWQCSRk0JhYa/4brvcTvbhlpnhmMaMDOBxrdB9LK0Fq+NP5mEOtU/1sCqzFE0mc6NYaunnyA8NaEEdplupJ4+5R9HqDK1c+QdZpncnRiew5CpTazqMZvkMG6DGi7wSE4hsnHoKqrTW3gkSQMb6hBCkDy20geR/IX8j9i2NvzzlSQYEx1uYVT6D5DKOfl7L7Fha5yE9xF1GuJB0Phz00g+AzR3XiE1KpYXUuW44dDdvDM7QcaramCSIixlExT0ISjnwofixqJC21+AFA+TROlAdRvE2PzsAlL4/nTTw4mHHbOpGE7dwcuwWSNPDbuAnB9poRoayXg+dCJ+Tuu30iVFl2j+P++OrvHgNofrpQ6R/Rw/7vZJ0Y3G3mV/Fra+WSg==",
      "body": "{\n  \"Type\" : \"Notification\",\n  \"MessageId\" : \"b6b6d8bf-adf6-51cf-be6f-81f0c7ec48a0\",\n  \"TopicArn\" : \"arn:aws:sns:ap-northeast-1:339624179311:sns_sqs_event_test\",\n  \"Message\" : \"aeawefoaweifajwefoiawejfoi\",\n  \"Timestamp\" : \"2021-06-25T05:21:30.201Z\",\n  \"SignatureVersion\" : \"1\",\n  \"Signature\" : \"pJTvJAMr+c8xrQZMINyYJDBCCMnoXoBosDawDwujDbBgzn9snpRBSZ8BcSFQKg3hvDP6HacFQ8YMczX8RqGZnGyOtd7cgIH7w/mW1uPoimjYWeDxWe1aeOKGcG7TNuTnazgk1XXFKS/PONMtWX7I5Br+zStMS8llU8+2Hz++WlwaoPEgBUPksXVWHFyw9oGFx8SwdxstEz937TRZfmfAd/zqck+/xDYXRL7BPGHmV0jBUgqitewtfJN0fXFLGqSFpYywGyvgr6JfHp/LmlOPSrqaUtJ/RInRLMpyCHLOPpCpRNfB3QM8qxgsIFzyKJtXaJNQUy4ujhI0h1YxW95Zgg==\",\n  \"SigningCertURL\" : \"https://sns.ap-northeast-1.amazonaws.com/SimpleNotificationService-010a507c1833636cd94bdb98bd93083a.pem\",\n  \"UnsubscribeURL\" : \"https://sns.ap-northeast-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:ap-northeast-1:339624179311:sns_sqs_event_test:30fdd4dd-754b-446f-953c-cdd19b0b215a\"\n}",
      "attributes": {
        "ApproximateReceiveCount": "1",
        "SentTimestamp": "1624598490288",
        "SenderId": "AIDAIERWYNSNBY7YRB6SY",
        "ApproximateFirstReceiveTimestamp": "1624598490296"
      },
      "messageAttributes": {},
      "md5OfBody": "1f211e45615e4fc4ab4b89f138fde2ca",
      "eventSource": "aws:sqs",
      "eventSourceARN": "arn:aws:sqs:ap-northeast-1:339624179311:sns_sqs_event_check",
      "awsRegion": "ap-northeast-1"
    }
  ]
}
sinofsevensinofseven

SQS -> Lambda

{
  "Records": [
    {
      "messageId": "f1f81f75-c1c0-49a2-8b83-7c586ef2e2df",
      "receiptHandle": "AQEBoT6xOgCgDXNDbVAMHRNirRH3mVGWLdmMZk3SgGGuvj//jBH/nV9g+CwzpGcuIqnaqpWAfE74ZOpi81DZobnGxfWqWaE6m3gNQA3j5ikDq+c2+hLOH4dLDK+2dJvPYaJpU5gHMv1/sSf7u8r2dhxjzFxhYycl1blH1RjTPDcqBKGKZ6hoiOCfZWnrJF8WWR1PfZIjkYc6K8MhsYVWwRge9fDZP9ouOklZj63WQHEEpTgqwEpyKny4zpvzx7mjt9Uu+r2S9fQKlvdWaqP957aoA60SQpsooBvu51GCTaJ8yA+biqtk27Ohsip0rMrDMzHDgyrU10t+JK7ytb/e3rkSsrH6Ys/LOfMRxEd8EJMEOT4hpmojjoPK+hgqPklWSrNqeOg2PPUr7d1FiYZRDH0zew==",
      "body": "ttt",
      "attributes": {
        "ApproximateReceiveCount": "1",
        "SentTimestamp": "1624601278200",
        "SenderId": "AROAJLSDMO7XTYBF745TA:cm-natsume.yuta",
        "ApproximateFirstReceiveTimestamp": "1624601278202"
      },
      "messageAttributes": {},
      "md5OfBody": "9990775155c3518a0d7917f7780b24aa",
      "eventSource": "aws:sqs",
      "eventSourceARN": "arn:aws:sqs:ap-northeast-1:706499975499:sns_sqs_event_check",
      "awsRegion": "ap-northeast-1"
    }
  ]
}
sinofsevensinofseven

Kinesis Stream -> Lambda

{
    "Records": [
        {
            "kinesis": {
                "kinesisSchemaVersion": "1.0",
                "partitionKey": "84c9be9c-2c7d-4f50-99ac-a1adf79be74d",
                "sequenceNumber": "49620345996384724899857095351384416712260400711796260866",
                "data": "eyJ0ZXN0IjogIumXh+OCiOOCiuaal+OBjea3sea3teOCiOOCiuWHuuOBp+OBl+KAleWFtuOBneOBr+OAgeenkeWtpuOBruWFieOBjOiQveOBqOOBmeW9sSEifQ==",
                "approximateArrivalTimestamp": 1626876478.764
            },
            "eventSource": "aws:kinesis",
            "eventVersion": "1.0",
            "eventID": "shardId-000000000000:49620345996384724899857095351384416712260400711796260866",
            "eventName": "aws:kinesis:record",
            "invokeIdentityArn": "arn:aws:iam::651999373936:role/LambdaAdminExecRole",
            "awsRegion": "ap-northeast-1",
            "eventSourceARN": "arn:aws:kinesis:ap-northeast-1:651999373936:stream/event_test"
        }
    ]
}
sinofsevensinofseven

DynamoDB Stream -> Lambda (INSERT)

{
    "Records": [
        {
            "eventID": "87c16290d5cd0f642ea33f5dd202967f",
            "eventName": "INSERT",
            "eventVersion": "1.1",
            "eventSource": "aws:dynamodb",
            "awsRegion": "ap-northeast-1",
            "dynamodb": {
                "ApproximateCreationDateTime": 1628060298,
                "Keys": {
                    "path": {
                        "S": "t_path"
                    }
                },
                "NewImage": {
                    "path": {
                        "S": "t_path"
                    },
                    "key": {
                        "S": "aaa"
                    }
                },
                "SequenceNumber": "26900000000008001408338",
                "SizeBytes": 26,
                "StreamViewType": "NEW_AND_OLD_IMAGES"
            },
            "eventSourceARN": "arn:aws:dynamodb:ap-northeast-1:355081757265:table/event_test/stream/2021-08-04T06:56:04.379"
        }
    ]
}
sinofsevensinofseven

DynamoDB Stream -> Lambda (MODIFY)

{
    "Records": [
        {
            "eventID": "d9ce6e967074bcdf71fb06666438cac2",
            "eventName": "MODIFY",
            "eventVersion": "1.1",
            "eventSource": "aws:dynamodb",
            "awsRegion": "ap-northeast-1",
            "dynamodb": {
                "ApproximateCreationDateTime": 1628060405,
                "Keys": {
                    "path": {
                        "S": "t_path"
                    }
                },
                "NewImage": {
                    "path": {
                        "S": "t_path"
                    },
                    "key": {
                        "S": "aaa_b"
                    }
                },
                "OldImage": {
                    "path": {
                        "S": "t_path"
                    },
                    "key": {
                        "S": "aaa"
                    }
                },
                "SequenceNumber": "27000000000008001455740",
                "SizeBytes": 44,
                "StreamViewType": "NEW_AND_OLD_IMAGES"
            },
            "eventSourceARN": "arn:aws:dynamodb:ap-northeast-1:355081757265:table/event_test/stream/2021-08-04T06:56:04.379"
        }
    ]
}
sinofsevensinofseven

DynamoDB Stream -> Lambda (REMOVE)

{
    "Records": [
        {
            "eventID": "72aa15fc2292990dccaf051f95c48e77",
            "eventName": "REMOVE",
            "eventVersion": "1.1",
            "eventSource": "aws:dynamodb",
            "awsRegion": "ap-northeast-1",
            "dynamodb": {
                "ApproximateCreationDateTime": 1628060500,
                "Keys": {
                    "path": {
                        "S": "t_path"
                    }
                },
                "OldImage": {
                    "path": {
                        "S": "t_path"
                    },
                    "key": {
                        "S": "aaa_b"
                    }
                },
                "SequenceNumber": "27100000000008001501413",
                "SizeBytes": 28,
                "StreamViewType": "NEW_AND_OLD_IMAGES"
            },
            "eventSourceARN": "arn:aws:dynamodb:ap-northeast-1:355081757265:table/event_test/stream/2021-08-04T06:56:04.379"
        }
    ]
}
sinofsevensinofseven

DynamoDB -> Kinesis Stream -> Lambda

{
  "Records": [
    {
      "kinesis": {
        "kinesisSchemaVersion": "1.0",
        "partitionKey": "92FEEE058B5EA6431439C8AE1040CE52",
        "sequenceNumber": "49621226475120277132272949405100087996077180411625603074",
        "data": "eyJhd3NSZWdpb24iOiJhcC1ub3J0aGVhc3QtMSIsImV2ZW50SUQiOiIwM2ZhNmJjMC0zNzg0LTQ1MWQtYTEyOC01ZGMyNDU0MmYzM2EiLCJldmVudE5hbWUiOiJJTlNFUlQiLCJ1c2VySWRlbnRpdHkiOm51bGwsInJlY29yZEZvcm1hdCI6ImFwcGxpY2F0aW9uL2pzb24iLCJ0YWJsZU5hbWUiOiJkZGItc3RyZWFtLXRlc3QiLCJkeW5hbW9kYiI6eyJBcHByb3hpbWF0ZUNyZWF0aW9uRGF0ZVRpbWUiOjE2MjkzNDM5NzQxMTcsIktleXMiOnsiaWQiOnsiUyI6InRlc3QifX0sIk5ld0ltYWdlIjp7ImlkIjp7IlMiOiJ0ZXN0In0sIm5hbWUiOnsiUyI6Ik1rLlNlaW4ifX0sIlNpemVCeXRlcyI6MjN9LCJldmVudFNvdXJjZSI6ImF3czpkeW5hbW9kYiJ9",
        "approximateArrivalTimestamp": 1629343974.21
      },
      "eventSource": "aws:kinesis",
      "eventVersion": "1.0",
      "eventID": "shardId-000000000000:49621226475120277132272949405100087996077180411625603074",
      "eventName": "aws:kinesis:record",
      "invokeIdentityArn": "arn:aws:iam::215102275208:role/LambdaAdminExecRole",
      "awsRegion": "ap-northeast-1",
      "eventSourceARN": "arn:aws:kinesis:ap-northeast-1:215102275208:stream/ddb-stream-test"
    }
  ]
}
  • Kinesis StreamのLambdaとDynamoDB StreamのRecordを組み合わせた感じ
sinofsevensinofseven

EventBridge Schedule -> Lambda

{
    "version": "0",
    "id": "c06a9cb1-ac69-df62-0324-107ca664d646",
    "detail-type": "Scheduled Event",
    "source": "aws.events",
    "account": "893894737187",
    "time": "2021-08-21T09:23:07Z",
    "region": "ap-northeast-1",
    "resources": [
        "arn:aws:events:ap-northeast-1:893894737187:rule/schedule_event_test"
    ],
    "detail": {}
}
sinofsevensinofseven

Subscription Filter -> Lambda

{
    "awslogs": {
        "data": "H4sIAAAAAAAA/zWPy2rDMBBF/+WuHZAtz0jWLlA3q66cXQlFrWXH4BfSJMWE/HuJodtzLhzuA1NIyffhvK0BDm/H8/Hro26a46lGhuV3DhEOmkjZ3JApmJBhXPpTXG4rHCQkOYxLf+h3sLtGYvATHLz3yJBu3+knDqsMy/w+jBJigvvc5WXf1/cwy4s9MLSvmmHNpAomqgwV2qpcl5YMKcvKEGu2pii5KtlqazWbqqCitAoZZJhCEj+tcDlbw6bKS1NZlf3/hEN3l2u3SdttUVqJeF6efzfTfHwHAQAA"
    }
}