Created
December 7, 2016 23:46
-
-
Save jpbarto/38ce994ced3f85128243d50fc11b7b0b to your computer and use it in GitHub Desktop.
AWS Lambda function that deletes itself
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import boto3 | |
lclient = boto3.client ('lambda') | |
print ('function loaded') | |
def lambda_handler(event, context): | |
lclient.delete_function (FunctionName = context.function_name) | |
print ('I am deleted') | |
return True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does this actually work?
I always wondered if this could work.
I assume this means you would have to give that function's role the permission to delete itself?
[Update]
I can confirm this DOES work.
You do need to give that function's role permission to delete itself.