When deploying a Python Flask app to AWS Lambda using Zappa
I would rather do it this way than have a Zappa role automatically created for me which I have to modify
CodePudding user response:
You can define a specific role that you already have created in AWS, this can be done by adding the following to your zappa_settings.json
file.
{
"myenvironment": {
...
"manage_roles": false, // Disable Zappa client managing roles.
"role_name": "MyLambdaRole", // Name of your Zappa execution role. Optional, default: <project_name>-<env>-ZappaExecutionRole.
"role_arn": "arn:aws:iam::12345:role/app-ZappaLambdaExecutionRole", // ARN of your Zappa execution role. Optional.
...
},
...
}
where you can define the name of the role or its ARN. I would prefer to use the role's ARN.
You can read more about it in Zappa's official documentation Read here, you can also find out what are the minimum permissions Zappa needs to work in the following discussion Read here