AV Lambda Extension
Learn how to set up Sedai's AV Lambda in your AWS account in order to enable autonomous concurrency management for your AWS Lambdas.
The AV Lambda extension acts as Sedai's control center for your AWS Lambda functions. It is responsible for collecting metrics from Sedai's autonomous concurrency extensions and communicating with Sedai core components.
You can choose to deploy the AV Lambda using one of the following methods:
git clone [email protected]:SedaiEngineering/sedai-extensions.git
cd sedai-extensions/sedai-avlambda-cdk/
curl -o lib/avlambda.zip https://github.com/SedaiEngineering/sedai-extensions/releases/download/0.1.2/avlambda.zip -J -L
npm i -g aws-cdk
npm install
cdk bootstrap
cdk deploy
This will take a few minutes. CDK and CloudFormation Stack will provision the IAM Roles, DynamoDB and the Lambda Function on your AWS Account. You can view the progress in CloudFormation > Stacks > sedai-avlambda-stack.
mkdir sedai-avlambda
cd sedai-avlambda
curl https://github.com/SedaiEngineering/sedai-extensions/releases/download/0.1.2/avlambda.zip -O -J -L
unzip avlambda.zip
rm -rf avlambda.zip
curl -O https://raw.githubusercontent.com/SedaiEngineering/sedai-onboarding/main/serverless/avlambda/cloudformation.yml
Resources:
SedaiavlambdaLambdaFunction:
Properties:
CodeUri: "/path/to/AVLambdaGo"
aws s3 mb s3://<sedai-cloudformation-artifacts> --region <region>
aws cloudformation package --template cloudform.yml --s3-bucket <sedai-cloudformation-artifacts>
--output-template-file final.yml
aws cloudformation deploy --template final.yml --stack-name sedai-avlambda-stack --capabilities
CAPABILITY_NAMED_IAM --region <region>
This will take a few minutes. CloudFormation will provision the IAM Roles, DynamoDB and the Lambda Function on your AWS Account. You can view the progress in CloudFormation > Stacks > sedai-avlambda-stack.
Before you get started, please make sure you install Serverless Framework 3 and configure AWS Credentials as recommended.
mkdir sedai-avlambda
cd sedai-avlambda
curl https://github.com/SedaiEngineering/sedai-extensions/releases/download/0.1.2/avlambda.zip -O -J -L
unzip avlambda.zip
rm -rf avlambda.zip
curl -O https://raw.githubusercontent.com/SedaiEngineering/sedai-onboarding/main/serverless/avlambda/serverless.yaml
You can skip this step if it is already installed.
sudo apt-get update
sudo apt-get install curl
curl -o- -L https://slss.io/install | bash
Add the following to
~/.bashrc
or ~/.profile
:export PATH="$HOME/.serverless/bin:$PATH"
sls plugin install -n serverless-dynamodb-autoscaling
sls deploy --region <AWS-REGION> --stage production
This will take a few minutes. Serverless Framework will provision the IAM Roles, DynamoDB and the Lambda Function on your AWS Account.
In this method, you will log into your AWS account in order to manually provision AWS Lambda and associated resources.
⚠️ In order to complete setup, you must have permission within your AWS account to provision Lambda functions, DynamoDB Tables, and IAM Roles.
Navigate to your DynamoDB Console and select Create Table; enter the following details to provision a new DynamoDB table for the AV Lambda backend:
- Table Name: SedaiResourceConcurrencyStats
- Partition Key:
resourceId
,String
- Settings: Custom Settings
- Read/write Capacity Settings: Provisioned
- Autoscaling:
ON
for Read and Write (use default values) - Encryption at Rest: Use default KMS-based encryption
- Tags: Optional (add per your organization's policy for creating new tables)
In this step you will grant access for the DynamoDB table to invoke Lambda functions:
- Navigate to IAM Console > Roles and select Create Role. Select AWS Service as your trusted entity and choose Lambda as the use case.
- Select Next to Add permissions, and click the Create Policy button. In the new window, toggle to the JSON editor tab.
- Download a sample template from Sedai's repository and update the
<AWS-REGION>
and<AWS-ACCOUNT-ID>
placeholders in it, then paste the policy into the JSON editor. Select Next to optionally add tags, then Next to review the policy. Enter a unique name for the policy (such asiam-policy-sedai-avlambda-control-center
) and select Create Policy to complete. - From the Add permissions page, refresh the list and select the newly created IAM policy. Click Next and enter a unique name for the role (such as
iam-role-sedai-avlambda-control-center
) and click on Create Role to finish setup.
curl https://github.com/SedaiEngineering/sedai-extensions/releases/download/0.1.2/avlambda.zip -O -J -L
- Choose Author from scratch and name the function
Sedai-avlambda-control-center
. - For the runtime, select Go.1.x and choose x86_64 for the architecture.
- Under the Permissions section, expand Change default execution role and select Use an existing role. Select the role created in the step 2.
- Expand the Advanced Settings section and select Enable function URL; keep the default selection of AWS_IAM.
Please send the Lambda URL as well as your Sedai URL to [email protected].
Last modified 10mo ago