aws lambda power tuning

0

Hello. I am Implementing lambda power tuning, follow below link https://github.com/alexcasalboni/aws-lambda-power-tuning Then I follow https://serverlessrepo.aws.amazon.com/applications/arn:aws:serverlessrepo:us-east-1:451282441545:applications~aws-lambda-power-tuning Deploy the serverless application in cloudformation. Then in the aws step function I clicked on start executor, there I put
{ "lambdaARN": "your-lambda-function-arn", # put lambda ARN here "powerValues": [128, 256, 512, 1024, 2048, 3008], "num": 10, "payload": "{}", "parallelInvocation": true, "strategy": "cost" } It works fine. After that I want to test multiple lambda functions, so for this I will create multiple state machine or can I put multiple lambda ARN in one machine ? After that how can I put it in our infra to test. I need guidance to implement it. Thanks

1 Answer
0
Accepted Answer

You deploy the tool once. It is a Step Functions state machine. When you invoke the state machine, you need to provide it with some input. This specific state machines expect the input in the following format:

{
    "lambdaARN": "your-lambda-function-arn",
    "powerValues": [128, 256, 512, 1024],
    "num": 50,
    "payload": {}
}

As you can see, you need to provide the ARN of the function that you want to test, as well as the payload you need to pass to the function when the tool invokes it. You can find the full details for the input object here.

You can invoke it from the Step Functions console, from the AWS CLI, or programmatically, using the StartExecution API.

You can find more information about including it in a CI/CD pipeline here.

profile pictureAWS
EXPERT
Uri
answered 6 months ago
  • Could you please elaborate a little bit.

  • I updated my answer.

  • yes I already execute this code in step function and put lambda ARN. It shows me the result. My main question is this that Can I execute multiple functions in one execution, Like this

    { "functions": [ { "lambdaARN": "arn:aws:lambda:region:account-id:function:function-name-1", "powerValues": [128, 256, 512, 1024], "num": 50, "payload": {} }, { "lambdaARN": "arn:aws:lambda:region:account-id:function:function-name-2", "powerValues": [256, 512, 1024, 2048], "num": 50, "payload": {} } // Add more functions as needed ] } Or should I create each execution for each lambda functions ? Actually we have above 50 lambda functions and I want it to put multiple lambda functions in one execution for testing. Is this possible

  • Oh. Now I understand. No. You will need to invoke the state machine for each function individually.

  • Ok, Thank you very much, appreciate your guidance. One more question if you don't mind. Can I create a lambda function, I will put multiple ARNs of lambda functions and integrate with step function it will create new execution for each lambda function automatically like this:

    import json import boto3

    def lambda_handler(event, context): lambda_client = boto3.client('lambda')
    # Function ARNs and their corresponding configurations lambda_arns = [ { "lambdaARN": "arn:aws:lambda:us-west-2:824967406436:function:lambda-power-tuning-test", "powerValues": [128, 256, 512, 1024, 2048, 3008], "num": 10, "payload": "{}", "parallelInvocation": False, "strategy": "cost" }, { "lambdaARN": "arn:aws:lambda:us-west-2:824967406436:function:DemoLambdaFunction", "powerValues": [128, 256, 512, 1024, 2048, 3008], "num": 10, "payload": "{}", "parallelInvocation": False, "strategy": "cost" } ]

    # Create separate executions for each Lambda function ARN
    for lambda_arn_config in lambda_arns:
        lambda_client.start_lambda_power_tuning(
            FunctionName=lambda_arn_config["lambdaARN"],
            PowerValues=lambda_arn_config["powerValues"],
            NumInvocationsPerPowerValue=lambda_arn_config["num"],
            Payload=lambda_arn_config["payload"],
    

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions