New in version 2016.3.0.
Create and destroy Lambda Functions. Be aware that this interacts with Amazon's services, and so may incur charges.
boto
boto3
The dependencies listed above can be installed via package or pip.
This module accepts explicit vpc credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API and no further configuration is necessary. More information available here.
If IAM roles are not used you need to specify them either in a pillar file or in the minion's config file:
vpc.keyid: GKTADJGHEIQSXMKKRBJ08H
vpc.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
It's also possible to specify key
, keyid
and region
via a profile,
either passed in as a dict, or as a string to pull from pillars or minion
config:
myprofile:
keyid: GKTADJGHEIQSXMKKRBJ08H
key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
region: us-east-1
Ensure function exists:
boto_lambda.function_present:
- FunctionName: myfunction
- Runtime: python2.7
- Role: iam_role_name
- Handler: entry_function
- ZipFile: code.zip
- S3Bucket: bucketname
- S3Key: keyname
- S3ObjectVersion: version
- Description: "My Lambda Function"
- Timeout: 3
- MemorySize: 128
- region: us-east-1
- keyid: GKTADJGHEIQSXMKKRBJ08H
- key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
Ensure alias with passed properties is absent.
The name of the state definition.
Name of the function.
Name of the alias.
Region to connect to.
Secret key to be used.
Access key to be used.
A dict with region, key and keyid, or a pillar key (string) that contains a dict with region, key and keyid.
Ensure alias exists.
The name of the state definition.
Name of the function for which you want to create an alias.
The name of the alias to be created.
Function version for which you are creating the alias.
A short, user-defined function description. Lambda does not use this value. Assign a meaningful description as you see fit.
Region to connect to.
Secret key to be used.
Access key to be used.
A dict with region, key and keyid, or a pillar key (string) that contains a dict with region, key and keyid.
Ensure event source mapping with passed properties is absent.
The name of the state definition.
ARN of the event source.
Name of the lambda function.
Region to connect to.
Secret key to be used.
Access key to be used.
A dict with region, key and keyid, or a pillar key (string) that contains a dict with region, key and keyid.
Ensure event source mapping exists.
The name of the state definition.
The Amazon Resource Name (ARN) of the Amazon Kinesis or the Amazon DynamoDB stream that is the event source.
The Lambda function to invoke when AWS Lambda detects an event on the stream.
You can specify an unqualified function name (for example, "Thumbnail") or you can specify Amazon Resource Name (ARN) of the function (for example, "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). Note that the length constraint applies only to the ARN. If you specify only the function name, it is limited to 64 character in length.
The position in the stream where AWS Lambda should start reading. (TRIM_HORIZON | LATEST)
Indicates whether AWS Lambda should begin polling the event source. By default, Enabled is true.
The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function. Your function receives an event with all the retrieved records. The default is 100 records.
Region to connect to.
Secret key to be used.
Access key to be used.
A dict with region, key and keyid, or a pillar key (string) that contains a dict with region, key and keyid.
Ensure function with passed properties is absent.
The name of the state definition.
Name of the function.
Region to connect to.
Secret key to be used.
Access key to be used.
A dict with region, key and keyid, or a pillar key (string) that contains a dict with region, key and keyid.
Ensure function exists.
The name of the state definition
Name of the Function.
The Runtime environment for the function. One of 'nodejs', 'java8', or 'python2.7'
The name or ARN of the IAM role that the function assumes when it executes your function to access any other AWS resources.
The function within your code that Lambda calls to begin execution. For Node.js it is the module-name.*export* value in your function. For Java, it can be package.classname::handler or package.class-name.
A path to a .zip file containing your deployment package. If this is specified, S3Bucket and S3Key must not be specified.
Amazon S3 bucket name where the .zip file containing your package is stored. If this is specified, S3Key must be specified and ZipFile must NOT be specified.
The Amazon S3 object (the deployment package) key name you want to upload. If this is specified, S3Key must be specified and ZipFile must NOT be specified.
The version of S3 object to use. Optional, should only be specified if S3Bucket and S3Key are specified.
A short, user-defined function description. Lambda does not use this value. Assign a meaningful description as you see fit.
The function execution time at which Lambda should terminate this function. Because the execution time has cost implications, we recommend you set this value based on your expected execution time. The default is 3 seconds.
The amount of memory, in MB, your function is given. Lambda uses this memory size to infer the amount of CPU and memory allocated to your function. Your function use-case determines your CPU and memory requirements. For example, a database operation might need less memory compared to an image processing function. The default value is 128 MB. The value must be a multiple of 64 MB.
If your Lambda function accesses resources in a VPC, you must provide this parameter identifying the list of security group IDs/Names and subnet IDs/Name. These must all belong to the same VPC. This is a dict of the form:
VpcConfig:
SecurityGroupNames:
- mysecgroup1
- mysecgroup2
SecurityGroupIds:
- sg-abcdef1234
SubnetNames:
- mysubnet1
SubnetIds:
- subnet-1234abcd
- subnet-abcd1234
If VpcConfig is provided at all, you MUST pass at least one security group and one subnet.
A list of permission definitions to be added to the function's policy
IAM Roles may take some time to propagate to all regions once created. During that time function creation may fail; this state will atuomatically retry this number of times. The default is 5.
The parent object that contains your environment's configuration settings. This is a dictionary of the form:
{
'Variables': {
'VariableName': 'VariableValue'
}
}
New in version 2017.7.0.
Region to connect to.
Secret key to be used.
Access key to be used.
A dict with region, key and keyid, or a pillar key (string) that contains a dict with region, key and keyid.