title: In CloudFormation, how do I target a Lambda alias in Events::Rule
body: <p>I'm trying to trigger a Lambda:alias (the alias is key here) on a schedule. The following code errors out with</p>
  <blockquote>
  <p>&quot;SampleLambdaLiveAlias is not valid. Reason: Provided Arn is not in
  correct format. (Service: AmazonCloudWatchEvents; Status Code: 400;
  Error Code: ValidationException;&quot;</p>
  </blockquote>
  <p>How do I properly target the lambda:alias in CloudFormation? I've tried <code>!Ref</code>, <code>!Sub</code> and just the logical name.</p>
  <p>My custom-resource approach to retrieving the latest lambda version appears to be a necessary evil of setting up the &quot;live&quot; alias because AWS maintains old lambda versions, even after you delete the lambda and stack AND a valid version is required for a new alias. If anyone knows a more elegant approach to that problem, please see: <a href="https://stackoverflow.com/questions/63821300/how-to-use-sam-deploy-to-get-a-lambda-with-autopublishalias-and-additional-alis">how-to-use-sam-deploy-to-get-a-lambda-with-autopublishalias-and-additional-alises</a></p>
  <pre><code>SampleLambdaFunction:
      Type: AWS::Serverless::Function
      Properties:
          FunctionName: SampleLambda
          AutoPublishAlias: staging
          CodeUri: src/
          Handler: SampleLambda.handler
          MemorySize: 512
          Runtime: nodejs12.x
          Role: !GetAtt SampleLambdaRole.Arn
  SampleLambdaLiveAlias:
      Type: AWS::Lambda::Alias
      Properties:
          FunctionName: !Ref SampleLambdaFunction
          FunctionVersion: !GetAtt SampleLambdaGetMaxVersionFunction.version
          Name: live
  SampleLambdaFunctionScheduledEvent:
      Type: AWS::Events::Rule
      Properties:
          State: ENABLED
          ScheduleExpression: rate(1 minute) # same as cron(0/1 * * * ? *)
          Description: Run SampleLambdaFunction once every 5 minutes.
          Targets:
          - Id: EventSampleLambda
              Arn: SampleLambdaLiveAlias
  </code></pre>