config_file_example.rst
3.5 KB
The Config File
The config file is at the heart of kappa. It is what describes your functions and drives your deployments. This section provides a reference for all of the elements of the kappa config file.
Example
Here is an example config file showing all possible sections.
1 ---
2 name: kappa-python-sample
3 environments:
4 env1:
5 profile: profile1
6 region: us-west-2
7 policy:
8 resources:
9 - arn: arn:aws:dynamodb:us-west-2:123456789012:table/foo
10 actions:
11 - "*"
12 - arn: arn:aws:logs:*:*:*
13 actions:
14 - "*"
15 event_sources:
16 -
17 arn: arn:aws:kinesis:us-west-2:123456789012:stream/foo
18 starting_position: LATEST
19 batch_size: 100
20 env2:
21 profile: profile2
22 region: us-west-2
23 policy_resources:
24 - arn: arn:aws:dynamodb:us-west-2:234567890123:table/foo
25 actions:
26 - "*"
27 - arn: arn:aws:logs:*:*:*
28 actions:
29 - "*"
30 event_sources:
31 -
32 arn: arn:aws:kinesis:us-west-2:234567890123:stream/foo
33 starting_position: LATEST
34 batch_size: 100
35 lambda:
36 description: A simple Python sample
37 handler: simple.handler
38 runtime: python2.7
39 memory_size: 256
40 timeout: 3
41 vpc_config:
42 security_group_ids:
43 - sg-12345678
44 - sg-23456789
45 subnet_ids:
46 - subnet-12345678
47 - subnet-23456789
Explanations:
Line Number | Description |
---|---|
2 | This name will be used to name the function itself as well as any policies and roles created for use by the function. |
3 | A map of environments. Each environment represents one possible deployment target. For example, you might have a dev and a prod. The names can be whatever you want but the environment names are specified using the --env option when you deploy. |
5 | The profile name associated with this environment. This refers to a profile in your AWS credential file. |
6 | The AWS region associated with this environment. |
7 | This section defines the elements of the IAM policy that will be created for this function in this environment. |
9 | Each resource your function needs access to needs to be listed here. Provide the ARN of the resource as well as a list of actions. This could be wildcarded to allow all actions but preferably should list the specific actions you want to allow. |
15 | If your Lambda function has any event sources, this would be where you list them. Here, the example shows a Kinesis stream but this could also be a DynamoDB stream, an SNS topic, or an S3 bucket. |
18 | For Kinesis streams and DynamoDB streams, you can specify the starting position (one of LATEST or TRIM_HORIZON) and the batch size. |
35 | This section contains settings specify to your Lambda function. See the Lambda docs for details on these. |