makeporngreatagain.pro
yeahporn.top
hd xxx

Create a “Hello, World!” Lambda function

526

This function returns a greeting to the caller as a JSON object in the following format:

{
    "greeting": "Good {time}, {name} of {city}.[ Happy {day}!]"
  1. Sign in to the Lambda console at https://console.aws.amazon.com/lambda.
  2. On the AWS navigation bar, choose a region (for example, US East (N. Virginia).
  3. Choose Functions in the navigation pane.
  4. Choose Create function.
  5. Choose Author from scratch.
  6. Under Basic information, do the following:
    1. In Function name, enter GetStartedLambdaProxyIntegration.
    2. From the Runtime dropdown list, choose a supported Node.js runtime.
    3. Under Permissions, expand Choose or create an execution role. From the Execution role dropdown list, choose Create new role from AWS policy templates.
    4. In Role name, enter GetStartedLambdaBasicExecutionRole.
    5. Leave the Policy templates field blank.
    6. Choose Create function.
  7. Under Function code, in the inline code editor, copy/paste the following code:
    'use strict';
    console.log('Loading hello world function');
     
    exports.handler = async (event) => {
        let name = "you";
        let city = 'World';
        let time = 'day';
        let day = '';
        let responseCode = 200;
        console.log("request: " + JSON.stringify(event));
        
        if (event.queryStringParameters && event.queryStringParameters.name) {
            console.log("Received name: " + event.queryStringParameters.name);
            name = event.queryStringParameters.name;
        }
        
        if (event.queryStringParameters && event.queryStringParameters.city) {
            console.log("Received city: " + event.queryStringParameters.city);
            city = event.queryStringParameters.city;
        }
        
        if (event.headers && event.headers['day']) {
            console.log("Received day: " + event.headers.day);
            day = event.headers.day;
        }
        
        if (event.body) {
            let body = JSON.parse(event.body)
            if (body.time) 
                time = body.time;
        }
     
        let greeting = `Good ${time}, ${name} of ${city}.`;
        if (day) greeting += ` Happy ${day}!`;
    
        let responseBody = {
            message: greeting,
            input: event
        };
        
        // The output from a Lambda proxy integration must be 
        // in the following JSON object. The 'headers' property 
        // is for custom response headers in addition to standard 
        // ones. The 'body' property  must be a JSON string. For 
        // base64-encoded payload, you must also set the 'isBase64Encoded'
        // property to 'true'.
        let response = {
            statusCode: responseCode,
            headers: {
                "x-custom-header" : "my custom header value"
            },
            body: JSON.stringify(responseBody)
        };
        console.log("response: " + JSON.stringify(response))
        return response;
    };
  8. Choose Save

Comments are closed, but trackbacks and pingbacks are open.

baseofporn.com https://www.opoptube.com
Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.