Is there a way to set the name of a CloudWatch rule that is triggered by a CloudWatch Event?
When I create a Lambda function that is triggered by a CloudWatch rule that is scheduled, then the CloudWatch rule is created with the name I specify in the name field. For instance, the following code in serverless.yml creates a CloudWatch rule called lambda-tag-ebs-volumes.
events: - schedule: name: lambda-tag-ebs-volumes description: This triggers the lambda_tag_ebs_volumes function once a day at 16:00 GMT. rate: cron(0 16 * * ? *) enabled: true
When I create a Lambda function that is triggered by an event, then the CloudWatch rule name is generated programmatically. For instance, the following code in serverless.yml created a CloudWatch rule called lambda-t2-unlimited-nonpr-T2UnlimitedEventsRuleClo-1I011KITZ6YM2:
events: - cloudwatchEvent: name: 'lambda-t2-unlimited' description: This triggers the lambda_t2_unlimited function every time an EC2 instance is started. event: source: - "aws.ec2" detail-type: - "EC2 Instance State-change Notification" detail: state: - running