Spaces:
No application file
No application file
File size: 4,545 Bytes
907462b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | version: "0.2"
title: Create An AWS Lambda Function
description: This wizard will create a new AWS Lambda function for you
plan:
basics:
shortname: Intro
description: Provide function name and runtime
values:
function_name:
type: prompt
description: Function name
runtime:
type: prompt
description: Select the Lambda runtime
choices:
- actual_value: python2.7
display: Python 2.7
- actual_value: python3.6
display: Python 3.6
- actual_value: python3.7
display: Python 3.7
- actual_value: nodejs4.3
display: Node.js 4.3
- actual_value: nodejs6.10
display: Node.js 6.10
- actual_value: nodejs8.10
display: Node.js 8.10
- actual_value: java8
display: Java 8
- actual_value: dotnetcore1.0
display: .NET Core 1.0 (C#)
- actual_value: dotnetcore2.0
display: .NET Core 2.0 (C#)
- actual_value: dotnetcore2.1
display: .NET Core 2.1 (C#)
- actual_value: go1.
display: Go 1.x
role:
shortname: Permissions
description: Provide Role to be used by Lmanbda function
values:
existing_roles:
type: apicall
operation: iam.ListRoles
params: {}
query: "sort_by(Roles[].{display: RoleName, actual_value: Arn}, &display)"
cache: true
role_arn:
type: prompt
description: Select the role to use
choices: existing_roles
handler:
shortname: Handler
description: Provide handler and code location
values:
handler:
type: prompt
description: Enter the handler for your function
zip_filename:
type: prompt
completer: file_completer
description: Enter location of your code zip file
preview:
shortname: Preview
description: Preview results
values:
preview_cli_command_value:
type: template
value: |
aws lambda create-function \
--function-name '{function_name}' \
--role '{role_arn}' \
--runtime '{runtime}' \
--handler '{handler}' \
--zip-file fileb://{zip_filename}
preview_cfn_template_value:
type: template
value: |
Resources:
{function_name}:
Type: "AWS::Lambda::Function"
Properties:
FunctionName: {function_name}
Runtime: {runtime}
Handler: {handler}
Role: {role_arn}
Code:
# Replace the below properties after uploading code zip file to S3
S3Bucket: REPLACE-WITH-BUCKET-NAME
S3Key: REPLACE-WITH-KEY-NAME
preview_value:
type: template
value: |
{%if {preview_type} == preview_cli_command %}
{preview_cli_command_value}
{% endif %}
{%if {preview_type} == preview_cfn_template %}
{preview_cfn_template_value}
{% endif %}
preview_type:
type: prompt
description: Select an preview format
choices:
- display: None
actual_value: preview_none
- display: AWS CLI command
actual_value: preview_cli_command
- display: AWS CloudFormation template
actual_value: preview_cfn_template
details:
value: preview_value
visible: True
description: "Preview"
__DONE__:
execute:
default:
- type: apicall
operation: lambda.CreateFunction
output_var: function_arn
query: FunctionArn
params:
FunctionName: "{function_name}"
Role: "{role_arn}"
Runtime: "{runtime}"
Handler: "{handler}"
Code:
ZipFile:
__wizard__:File:
path: "{zip_filename}"
__OUTPUT__:
value: |
Wizard successfully created Lambda Function:
Function name: {function_name}
Function ARN: {function_arn}
{% if {preview_type} == preview_cli_command %}
Steps to create function is equivalent to running the following sample AWS CLI commands:
{preview_cli_command_value}
{% endif %}
{% if {preview_type} == preview_cfn_template %}
Steps to create function is equivalent to deploying the following sample AWS CloudFormation template:
{preview_cfn_template_value}
{% endif %}
|