AWS lambda documentation change
Summary
Added PowerShell V5 examples demonstrating Lambda function creation with IAM roles and environment variables
Security assessment
Documents security-relevant features (IAM role assignment, environment variables) but doesn't address vulnerabilities. Shows secure configuration practices rather than fixing issues.
Diff
diff --git a/lambda/latest/dg/example_lambda_CreateFunction_section.md b/lambda/latest/dg/example_lambda_CreateFunction_section.md index ed06f24f7..03a321252 100644 --- a//lambda/latest/dg/example_lambda_CreateFunction_section.md +++ b//lambda/latest/dg/example_lambda_CreateFunction_section.md @@ -540,0 +541,54 @@ PowerShell +**Tools for PowerShell V5** + + +**Example 1: This example creates a new C# (dotnetcore1.0 runtime) function named MyFunction in AWS Lambda, providing the compiled binaries for the function from a zip file on the local file system (relative or absolute paths may be used). C# Lambda functions specify the handler for the function using the designation AssemblyName::Namespace.ClassName::MethodName. You should replace the assembly name (without .dll suffix), namespace, class name and method name parts of the handler spec appropriately. The new function will have environment variables 'envvar1' and 'envvar2' set up from the provided values.** + + + Publish-LMFunction -Description "My C# Lambda Function" ` + -FunctionName MyFunction ` + -ZipFilename .\MyFunctionBinaries.zip ` + -Handler "AssemblyName::Namespace.ClassName::MethodName" ` + -Role "arn:aws:iam::123456789012:role/LambdaFullExecRole" ` + -Runtime dotnetcore1.0 ` + -Environment_Variable @{ "envvar1"="value";"envvar2"="value" } + + +**Output:** + + + CodeSha256 : /NgBMd...gq71I= + CodeSize : 214784 + DeadLetterConfig : + Description : My C# Lambda Function + Environment : Amazon.Lambda.Model.EnvironmentResponse + FunctionArn : arn:aws:lambda:us-west-2:123456789012:function:ToUpper + FunctionName : MyFunction + Handler : AssemblyName::Namespace.ClassName::MethodName + KMSKeyArn : + LastModified : 2016-12-29T23:50:14.207+0000 + MemorySize : 128 + Role : arn:aws:iam::123456789012:role/LambdaFullExecRole + Runtime : dotnetcore1.0 + Timeout : 3 + Version : $LATEST + VpcConfig : + +**Example 2: This example is similar to the previous one except the function binaries are first uploaded to an Amazon S3 bucket (which must be in the same region as the intended Lambda function) and the resulting S3 object is then referenced when creating the function.** + + + Write-S3Object -BucketName amzn-s3-demo-bucket -Key MyFunctionBinaries.zip -File .\MyFunctionBinaries.zip + Publish-LMFunction -Description "My C# Lambda Function" ` + -FunctionName MyFunction ` + -BucketName amzn-s3-demo-bucket ` + -Key MyFunctionBinaries.zip ` + -Handler "AssemblyName::Namespace.ClassName::MethodName" ` + -Role "arn:aws:iam::123456789012:role/LambdaFullExecRole" ` + -Runtime dotnetcore1.0 ` + -Environment_Variable @{ "envvar1"="value";"envvar2"="value" } + + + * For API details, see [CreateFunction](https://docs.aws.amazon.com/powershell/v5/reference) in _AWS Tools for PowerShell Cmdlet Reference (V5)_. + + + +