# CloudWatch Rule Name for Lambda Functions

**URL:** <https://forum.serverless.com/t/cloudwatch-rule-name-for-lambda-functions/5550>\
**Category:** Serverless Framework\
**Tags:** lambda\
**Created:** [August 23, 2018, 7:22pm UTC](https://forum.serverless.com/t/cloudwatch-rule-name-for-lambda-functions/5550 "2018-08-23T19:22:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jfserverless](https://avatars.discourse-cdn.com/v4/letter/j/ce73a5/32.png) [@jfserverless](https://forum.serverless.com/u/jfserverless)\
**Post date:** [August 23, 2018, 7:22pm UTC](https://forum.serverless.com/t/cloudwatch-rule-name-for-lambda-functions/5550/1 "2018-08-23T19:22:03Z")

</div>

_ **Question:** _  
Is there a way to set the name of a CloudWatch rule that is triggered by a CloudWatch Event?

_ **Background:** _  
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
> 
> ```

---

<div class="post-metadata">

**Author:** ![simlu](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/simlu/32/1739_2.png) [@simlu](https://forum.serverless.com/u/simlu)\
**Post date:** [November 16, 2018, 12:40am UTC](https://forum.serverless.com/t/cloudwatch-rule-name-for-lambda-functions/5550/2 "2018-11-16T00:40:53Z")

</div>

Did you ever find a solution for this?
