Each lambda function must be registered and configured in AWS to allow automatic updates in further. Your delivery package should contain a script for initial functions configuration. It can be either a bash or a terraform script.
Configuration Parameters
You can find detailed function parameter description in the create-function documentation, here are the Apination specifics:
Function Name
Use cn_{app}_{method_name} format.
For example, cn_salesforce_download_updates.
Role
Use “arn:aws:iam::354661630899:role/apination_connector_lambda”, this role gives the lambda function permissions to operate with the intermediate data storage (Amazon S3) and write logs to CloudWatch. If you need access to any other resources, talk to Apination administrator.
Runtime
You can use either Nodejs 4.3 or Python 2.7
Memory & Timeout
Because the execution time and memory consumption have cost implications, set these values based on expected function usage. In most scenarios, Apination lambda functions should not require more than 256Mb of memory.
Aliases
Each function should have 2 aliases (see AWS Lambda Versioning and Aliases for details)
STAGEpointing to the$LATESTversionPRODpointing to the latest stable fixed version
Registration Script
If you do not have developer access to the Apination AWS Console, you must provide a deployment script as a part of your delivery package. The script should create all your lambda functions and STAGE aliases.
Registering Function with AWS CLI
See docs.aws.amazon.com:
Registering Function with Terraform
See terraform.io docs:
From AWS Console UI (Apination Devs)
If you have developer access to the Apination AWS Console, you can register your function with the following steps:
- Login to the AWS Console
- Open AWS Lambda section in the US-EAST-1 region (N.Virginia)
- Click Create a Lambda Function, skip the step that suggests to use a prebuilt configuration, then configure the function
- Click Actions > Publish new version
- This will create version “1” of the function you just deployed
- Use current git version tag as a description
- Click Actions > Create Alias
- Name: STAGE
- Version: $LATEST (staging alias will always point to the latest function deployed)
- Actions > Create Alias
- Name: PROD
- Version: 1 (production alias must have a fixed version)