Skip to content

Instantly share code, notes, and snippets.

@AllieUbisse
Forked from Kalki5/add_policy.py
Created January 25, 2021 13:32
Show Gist options
  • Save AllieUbisse/975bfb4afc2406add9b0a98d224d927f to your computer and use it in GitHub Desktop.
Save AllieUbisse/975bfb4afc2406add9b0a98d224d927f to your computer and use it in GitHub Desktop.
Add own policy to a lambda function
import boto3
lamba_client = boto3.client('lambda', region_name='REGION_NAME')
lamba_client.add_permission(
FunctionName='create_lab',
StatementId='AWSEventsRule',
Action='lambda:InvokeFunction',
Principal='events.amazonaws.com',
SourceArn='arn:aws:events:REGION_NAME:ACCOUNT_NUMBER:rule/*',
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment