From 3aee2e170390e8a78e1de1d1d0ebebf71d15af59 Mon Sep 17 00:00:00 2001 From: Donne Martin Date: Tue, 11 Aug 2015 21:41:26 -0400 Subject: [PATCH] Added lambda functions to update a function config, add permissions, and to check policy permissions. Some lambda cleanup. --- aws/aws.ipynb | 74 +++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 69 insertions(+), 5 deletions(-) diff --git a/aws/aws.ipynb b/aws/aws.ipynb index 44062f2..d149034 100644 --- a/aws/aws.ipynb +++ b/aws/aws.ipynb @@ -961,6 +961,27 @@ " --debug" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Update a function:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "!aws lambda update-function-configuration \\\n", + " --function-name foo \\\n", + " --region us-east-1 \\\n", + " --timeout timeout-in-seconds \\" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -977,7 +998,7 @@ "outputs": [], "source": [ "!aws lambda get-function-configuration \\\n", - " --function-name helloworld \\\n", + " --function-name foo \\\n", " --region us-east-1 \\\n", " --debug" ] @@ -998,7 +1019,7 @@ "outputs": [], "source": [ "!aws lambda get-function \\\n", - " --function-name helloworld \\\n", + " --function-name foo \\\n", " --region us-east-1 \\\n", " --debug" ] @@ -1023,8 +1044,51 @@ " --function-name ProcessKinesisRecords \\\n", " --role invocation-role-arn \\\n", " --event-source kinesis-stream-arn \\\n", - " --batch-size 100 \\\n", - " --profile adminuser" + " --batch-size 100" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Add permissions:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "!aws lambda add-permission \\\n", + " --function-name CreateThumbnail \\\n", + " --region us-west-2 \\\n", + " --statement-id some-unique-id \\\n", + " --action \"lambda:InvokeFunction\" \\\n", + " --principal s3.amazonaws.com \\\n", + " --source-arn arn:aws:s3:::sourcebucket \\\n", + " --source-account bucket-owner-account-id" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Check policy permissions:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "!aws lambda get-policy \\\n", + " --function-name function-name" ] }, { @@ -1043,7 +1107,7 @@ "outputs": [], "source": [ "!aws lambda delete-function \\\n", - " --function-name helloworld \\\n", + " --function-name foo \\\n", " --region us-east-1 \\\n", " --debug" ]