Zappa
Zappa copied to clipboard
Is it posible set a resource-based policy?
I want to run an asynchronous task created in zappa in another lambda function.

I can actually run it if I modify it as follows, but after zappa update, it returns to the original state.
Is it posible set a resource-based policy on zappa_settings.json or others?
So you want to call an async task defined in a zappa deployed lambda function from another function?
yes
example
zappa deployed lambda function 1
from zappa.asynchronous import task
@task
def function1(data):
print(data)
No zappa deployed lambda function 2
def function2():
payload = {
"command": "zappa.asynchronous.route_lambda_task",
"task_path": "core.tasks.function1",
"args": [],
"kwargs": {
"data": "DONE"
},
}
client = boto3.client("lambda", region_name="ap-northeast-2")
client.invoke(
FunctionName="arn:aws:lambda:ap-northeast-2:494890851710:function:zappa-prod",
InvocationType="Event",
LogType="Tail",
Payload=json.dumps(payload),
)
You can give permissions to your No zappa deployed lambda function 2
to execute the zappa deployed lambda function 1
.
zappa has "extra_permissions" and "attach_policy" if you want to apply additional permissions to the zappa deployed lambda function. So you may be able to write a resource-based policy document and apply it to your zappa deployed lambda function with the attach_policy
configuration option.
Hi there! Unfortunately, this Issue has not seen any activity for at least 90 days. If the Issue is still relevant to the latest version of Zappa, please comment within the next 10 days if you wish to keep it open. Otherwise, it will be automatically closed.
Hi there! Unfortunately, this Issue was automatically closed as it had not seen any activity in at least 100 days. If the Issue is still relevant to the latest version of Zappa, please open a new Issue.