1.python code lamdba_function.py
def lambda_handler(event, context): message = 'Hello {} {}!'.format(event['first_name'], event['last_name']) return { 'message' : message }
2.zip code
zip lamdba_function.zip lamdba_function.py
3. upload zip to s3
4. creat role
5.creat lamdba_function.yaml
AWSTemplateFormatVersion: '2010-09-09' Description: Lambda function. Resources: Function: Type: AWS::Lambda::Function Properties: Handler: lamdba_function.lambda_handler #文件名+handler名称 Role: arn:aws:iam::856290849487:role/lamdba_role Code: S3Bucket: kaijia-test S3Key: lamdba_function.zip Runtime: python3.10 Timeout: 5 TracingConfig: Mode: Active
6. deploy
7. see function