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.

답변함 일 년 전
  • 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.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠