I have a flask project and it is deployed to the AWS Lambda using the Zappa, and it works fine. I'm trying to add an event in the zappa_settings.json
to run some function regularly. The settings config that was working (without events) was:
{
"dev": {
"app_function": "app.app",
"profile_name": "default",
"project_name": "contactclipper2",
"runtime": "python3.8",
"s3_bucket": "zappa-i4hsr8rya",
"aws_region": "us-west-2",
"keep_warm": false,
"use_precompiled_packages": false,
"memory_size": 3008
}
}
and I added these two lines, so the settings changed to:
{
"dev": {
"app_function": "app.app",
"profile_name": "default",
"project_name": "contactclipper2",
"runtime": "python3.8",
"s3_bucket": "zappa-i4hsr8rya",
"aws_region": "us-west-2",
"keep_warm": false,
"use_precompiled_packages": false,
"memory_size": 3008,
"events": [{
"function": "alerts.test_alert",
"expression": "rate(1 minute)"
}]
}
}
But now I can't update or schedule the project and I get this error:
botocore.exceptions.ClientError: An error occurred (ValidationException) when calling the PutRule operation: Provided role 'arn:aws:iam::199151782709:role/contactclipper2-dev-ZappaLambdaExecutionRole' cannot be assumed by principal 'events.amazonaws.com'.
This is the role's trust entities:
What should I do to fix this and have a working event (cron job)?