Set Lambda Function input > Constant in .yml

I’m able to create schedule rules with relative ease with the following :

functions:
  test:
    handler: handler.poll
    events:
      - schedule:
          rate: rate(1 minute)
          enabled: true

However what I’d like to be able to do is also pass in some constant JSON text. They give you the option in the AWS console like this:

Is there just a schedule param I’m missing?

Found this https://github.com/serverless/serverless/issues/2543

1 Like

As discussed on Gitter, this is solved with https://github.com/serverless/serverless/pull/2567

It should be in the v1.2.0 release.

1 Like

Do you know when v1.2.0 is going live?
And is it going to work with more coplex json something like that

[{"domain":".something.com","subdomains":{"origin":"origin-s","api":"s","site":"shoponline"},"region":"TH"}] 

v1.2.0 is due any moment now https://github.com/serverless/serverless/milestone/16

It should work with any JSON/YML object you put in there.

1 Like

Hi @rowanu I’ve just used serverless 1.2.0 and the JSON input worked like a charm :slight_smile:
I was wondering do you know if I can change the name of the CloudWatch Rule as currently is something like that:
function_name-env-Function_NameEventsRuleSchedule1-P4RWCPZQK971
It will be great if I can change the name to something else.

1 Like

Good to hear it worked, thanks for reporting back.

Unfortunately there’s no way to change the name that I’m aware of. It has
to be unique, and it’s helpful to see what resource relates to a specific
service/function.

Why do you care what it is named? The name has no material impact on the
functionality, so shouldn’t matter.

If you have some reporting requirements, better to change what you display
at the reporting level rather than expose the plumbing of your service.

It’s not that important just I like to have my CloudWatch Rules with proper naming using special syntax.
But the most important was that now I can pass my JSON input and it works :slight_smile:
Thanks one more time.

1 Like