1 Answer
- Newest
- Most votes
- Most comments
0
What about triggering the connection in the Systems Manager session manager to start Lambda?
This would allow us to run Lambda and launch EC2 when Amazon EventBridge detects a session manager event.
Below is an example of an Amazon EventBridge event pattern.
{
"source": ["aws.ssm"],
"detail-type": ["AWS API Call via CloudTrail"],
"detail": {
"eventSource": ["ssm.amazonaws.com"],
"eventName": ["StartSession"],
"requestParameters": {
"target": ["EC2 ID"]
}
}
}
Another possibility would be to enable VPC flow logging and use CloudWatch Logs subscription filters to share logs to Lambda when there is an SSH connection.
https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/SubscriptionFilters.html#LambdaFunctionExample
Please refer to the example in the following document for the Lambda function to be used for startup.
https://repost.aws/knowledge-center/start-stop-lambda-eventbridge
Relevant content
- asked 5 years ago
- asked 2 years ago
- asked 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago