linux_wiki:lambda_python_function

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
linux_wiki:lambda_python_function [2019/08/02 23:01]
billdozor [File Conversion Example: Packaging]
linux_wiki:lambda_python_function [2019/08/09 22:20]
billdozor [File Conversion Example: Pre-Reqs]
Line 18: Line 18:
 See below for Lambda examples. See below for Lambda examples.
   * File Conversion Example - convert images from one format to another when created in a S3 bucket.   * File Conversion Example - convert images from one format to another when created in a S3 bucket.
 +  * Stop/Start EC2 Instances Example - stop/start ec2 instances with a certain tag key:value on a schedule.
  
  
Line 54: Line 55:
  
 ---- ----
 +
 +===== Stop/Start EC2 Example: Pre-Reqs =====
 +
 +Create an IAM role
 +  * Services > Security > IAM > Roles > Create Role
 +    * Choose a service that will use the role: Lambda
 +    * Click 'Next:Permissions'
 +    * **Required**: Attach the AWS managed policy "AWSLambdaBasicExecutionRole" to your new role in order to log your Lambda function to cloudwatch logs.
 +    * Also, Create a new policy to allow basic EC2 list,stop,start. Example:<code json>{
 +    "Version": "2012-10-17",
 +    "Statement": [
 +        {
 +            "Sid": "VisualEditor0",
 +            "Effect": "Allow",
 +            "Action": [
 +                "ec2:DescribeInstances",
 +                "ec2:StartInstances",
 +                "ec2:StopInstances"
 +            ],
 +            "Resource": "*"
 +        }
 +    ]
 +}</code>
 +
 +----
 +
  
 ====== Lambda: Create Function ====== ====== Lambda: Create Function ======
  • linux_wiki/lambda_python_function.txt
  • Last modified: 2019/08/09 22:29
  • by billdozor