Mitch Garnaat

Updated README.md file based on new commands.

Showing 1 changed file with 31 additions and 18 deletions
...@@ -12,37 +12,52 @@ There are quite a few steps involved in developing a Lambda function. ...@@ -12,37 +12,52 @@ There are quite a few steps involved in developing a Lambda function.
12 You have to: 12 You have to:
13 13
14 * Write the function itself (Javascript only for now) 14 * Write the function itself (Javascript only for now)
15 -* Create the IAM roles required by the Lambda function itself (the executing 15 +* Create the IAM role required by the Lambda function itself (the executing
16 -role) as well as the policy required by whoever is invoking the Lambda 16 +role) to allow it access to any resources it needs to do its job
17 -function (the invocation role) 17 +* Add additional permissions to the Lambda function if it is going to be used
18 +in a Push model (e.g. S3, SNS) rather than a Pull model.
18 * Zip the function and any dependencies and upload it to AWS Lambda 19 * Zip the function and any dependencies and upload it to AWS Lambda
19 * Test the function with mock data 20 * Test the function with mock data
20 * Retrieve the output of the function from CloudWatch Logs 21 * Retrieve the output of the function from CloudWatch Logs
21 * Add an event source to the function 22 * Add an event source to the function
22 * View the output of the live function 23 * View the output of the live function
23 24
24 -Kappa tries to help you with some of this. The IAM roles are created 25 +Kappa tries to help you with some of this. It allows you to create an IAM
25 -in a CloudFormation template and kappa takes care of creating, updating, and 26 +managed policy or use an existing one. It creates the IAM execution role for
26 -deleting the CloudFormation stack. Kappa will also zip up the function and 27 +you and associates the policy with it. Kappa will zip up the function and
27 any dependencies and upload them to AWS Lambda. It also sends test data 28 any dependencies and upload them to AWS Lambda. It also sends test data
28 to the uploaded function and finds the related CloudWatch log stream and 29 to the uploaded function and finds the related CloudWatch log stream and
29 displays the log events. Finally, it will add the event source to turn 30 displays the log events. Finally, it will add the event source to turn
30 your function on. 31 your function on.
31 32
33 +If you need to make changes, kappa will allow you to easily update your Lambda
34 +function with new code or update your event sources as needed.
35 +
36 +Getting Started
37 +---------------
38 +
32 Kappa is a command line tool. The basic command format is: 39 Kappa is a command line tool. The basic command format is:
33 40
34 kappa <path to config file> <command> [optional command args] 41 kappa <path to config file> <command> [optional command args]
35 42
36 Where ``command`` is one of: 43 Where ``command`` is one of:
37 44
38 -* deploy - deploy the CloudFormation template containing the IAM roles and zip 45 +* create - creates the IAM policy (if necessary), the IAM role, and zips and
39 - the function and upload it to AWS Lambda 46 + uploads the Lambda function code to the Lambda service
40 -* test - send test data to the new Lambda function 47 +* invoke - make a synchronous call to your Lambda function, passing test data
48 + and display the resulting log data
49 +* invoke_async - make an asynchronous call to your Lambda function passing test
50 + data.
51 +* dryrun - make the call but only check things like permissions and report
52 + back. Don't actually run the code.
41 * tail - display the most recent log events for the function (remember that it 53 * tail - display the most recent log events for the function (remember that it
42 can take several minutes before log events are available from CloudWatch) 54 can take several minutes before log events are available from CloudWatch)
43 * add-event-sources - hook up an event source to your Lambda function 55 * add-event-sources - hook up an event source to your Lambda function
44 -* delete - delete the CloudFormation stack containing the IAM roles and delete 56 +* delete - delete the Lambda function, remove any event sources, delete the IAM
45 - the Lambda function 57 + policy and role
58 +* update_code - Upload new code for your Lambda function
59 +* update_event_sources - Update the event sources based on the information in
60 + your kappa config file
46 * status - display summary information about functions, stacks, and event 61 * status - display summary information about functions, stacks, and event
47 sources related to your project. 62 sources related to your project.
48 63
...@@ -58,14 +73,12 @@ An example project based on a Kinesis stream can be found in ...@@ -58,14 +73,12 @@ An example project based on a Kinesis stream can be found in
58 The basic workflow is: 73 The basic workflow is:
59 74
60 * Create your Lambda function 75 * Create your Lambda function
61 -* Create your CloudFormation template with the execution and invocation roles 76 +* Create any custom IAM policy you need to execute your Lambda function
62 * Create some sample data 77 * Create some sample data
63 * Create the YAML config file with all of the information 78 * Create the YAML config file with all of the information
64 -* Run ``kappa <path-to-config> deploy`` to create roles and upload function 79 +* Run ``kappa <path-to-config> create`` to create roles and upload function
65 -* Run ``kappa <path-to-config> test`` to invoke the function with test data 80 +* Run ``kappa <path-to-config> invoke`` to invoke the function with test data
66 -* Run ``kappa <path-to-config> tail`` to view the functions output in CloudWatch logs 81 +* Run ``kappa <path-to-config> update_code`` to upload new code for your Lambda
82 + function
67 * Run ``kappa <path-to-config> add-event-source`` to hook your function up to the event source 83 * Run ``kappa <path-to-config> add-event-source`` to hook your function up to the event source
68 * Run ``kappa <path-to-config> tail`` to see more output 84 * Run ``kappa <path-to-config> tail`` to see more output
69 -
70 -If you have to make changes in your function or in your IAM roles, simply run
71 -``kappa deploy`` again and the changes will be uploaded as necessary.
......