SAM Template How to add tags to a Serverless Function EventBridge Rule Schedule?

0

Hi,

I am using a Cloudformation SAM template to create a Serverless Lambda function and attach a Schedule (see example below). This creates a Lambda function and EventBridge rule resource successfully.

Adding tags for the Lambda function is fine. But I am struggling to work out how to add any tags to the EventBridge rule through this template (either custom tags or CloudFormation stack tags).

Does anyone know whether it is actually possible to add tags for an EventBridge rule via a SAM template?

Thanks!

Resources:
  myServerlessFunction:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: functions/sample/
      Handler: sample.lambdahandler
      Runtime: nodejs16.x
      Architectures:
        - x86_64
      MemorySize: 128
      Timeout: 100
      FunctionName: 'samplefunction'
      Description: A sample lambda function.
      Policies:
        - AWSLambdaBasicExecutionRole

      Tags:
        Env: dev

      Events:
        ScheduledFunction:
          Type: Schedule
          Properties:
            Name: 'sampleschedule'
            Schedule: rate(1 day)
1回答
0

Good question. According to this link from the Cloudformation documentation, the AWS::Events:Rule construct that creates the event, only supports tags when created with ECS. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-tag.html - I would assume that when SAM renders the Cloudformation, it will be bound by this same constraint.

回答済み 1年前
  • Thank you for your reply Vinoopal. I suspect your assumption here is most likely correct. Perhaps this functionality will be available for SAM templates in the future.

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ