Create a lambda function via using AWS S3 service.
- Create a new lambda function
- Update old codebase of the lambda
- You can connect with layer
- You can add trigger (Currently only S3 event)
- lambda_handler
- lambda_updater
- lambda_creator_decider
- function_creator
- Lambda creator
- lambda_add_permission
- When need to invoke any service for newly create function. more details
- add_s3_event_trigger
- Bucket trigger event creator.
- function_creator
-
Create a Role and Policy for Automate Deploy Lambda function in aws iam service. You can use this policy json or use full lambda access policy. If you want to give only few accesses the automate lambda function then you may use below json policy.
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "cloudwatch:*", "events:*", "lambda:*", "logs:*", "s3:*", "iam:PassRole" ], "Resource": "*" } ] }
-
Now go to lambda service and create a lambda function and use newly create role and paste the lambda-creator.py codebase into in your lambda function.
-
Now create a S3 bucket and setup the event notification with newly create the lambda function. and also set suffix as .zip . Because only generate the event when create new object with .zip extension. The event should be look like below image
-
Finished.