Skip to content

Instantly share code, notes, and snippets.

@vaskoz
Last active January 22, 2018 05:12
Show Gist options
  • Save vaskoz/df9b1c821951811098c876d44d681dd5 to your computer and use it in GitHub Desktop.
Save vaskoz/df9b1c821951811098c876d44d681dd5 to your computer and use it in GitHub Desktop.
Hi there from a C++ program
2018/01/22 05:09:25 <nil>
START RequestId: 6a2e5b39-ff32-11e7-805a-630e62a1c78b Version: $LATEST
Hi there from a C++ program
2018/01/22 05:09:25 <nil>
END RequestId: 6a2e5b39-ff32-11e7-805a-630e62a1c78b
REPORT RequestId: 6a2e5b39-ff32-11e7-805a-630e62a1c78b Duration: 179.64 ms Billed Duration: 200 ms Memory Size: 128 MB Max Memory Used: 14 MB
RequestId: 6a2e5b39-ff32-11e7-805a-630e62a1c78b Process exited before completing request
START RequestId: af8c002a-ff25-11e7-ad85-297f734c4d1d Version: $LATEST
2018/01/22 03:38:18 Golang version is this: devel +6104939432 Sun Jan 21 04:56:36 2018 +0000
2018/01/22 03:38:18 Number of CPUs is: 1
2018/01/22 03:38:18 printing environment variables
2018/01/22 03:38:18 PATH=/usr/local/bin:/usr/bin/:/bin
2018/01/22 03:38:18 LANG=en_US.UTF-8
2018/01/22 03:38:18 TZ=:UTC
2018/01/22 03:38:18 LD_LIBRARY_PATH=/lib64:/usr/lib64:/var/runtime:/var/runtime/lib:/var/task:/var/task/lib
2018/01/22 03:38:18 _LAMBDA_CONTROL_SOCKET=17
2018/01/22 03:38:18 _LAMBDA_CONSOLE_SOCKET=21
2018/01/22 03:38:18 LAMBDA_TASK_ROOT=/var/task
2018/01/22 03:38:18 LAMBDA_RUNTIME_DIR=/var/runtime
2018/01/22 03:38:18 _LAMBDA_LOG_FD=31
2018/01/22 03:38:18 _LAMBDA_SB_ID=17
2018/01/22 03:38:18 _LAMBDA_SHARED_MEM_FD=12
2018/01/22 03:38:18 AWS_REGION=us-west-2
2018/01/22 03:38:18 AWS_DEFAULT_REGION=us-west-2
2018/01/22 03:38:18 AWS_LAMBDA_LOG_GROUP_NAME=/aws/lambda/MyFirstGoFunction
2018/01/22 03:38:18 AWS_LAMBDA_LOG_STREAM_NAME=2018/01/22/[$LATEST]a71cfbc6b3064c8b9526967c7542a529
2018/01/22 03:38:18 AWS_LAMBDA_FUNCTION_NAME=MyFirstGoFunction
2018/01/22 03:38:18 AWS_LAMBDA_FUNCTION_MEMORY_SIZE=128
2018/01/22 03:38:18 AWS_LAMBDA_FUNCTION_VERSION=$LATEST
2018/01/22 03:38:18 _AWS_XRAY_DAEMON_ADDRESS=169.254.79.2
2018/01/22 03:38:18 _AWS_XRAY_DAEMON_PORT=2000
2018/01/22 03:38:18 AWS_XRAY_DAEMON_ADDRESS=169.254.79.2:2000
2018/01/22 03:38:18 AWS_XRAY_CONTEXT_MISSING=LOG_ERROR
2018/01/22 03:38:18 _X_AMZN_TRACE_ID=Parent=7fcb39185686fa1e
2018/01/22 03:38:18 _HANDLER=main
2018/01/22 03:38:18 _LAMBDA_RUNTIME_LOAD_TIME=2846440328883
2018/01/22 03:38:18 _LAMBDA_SERVER_PORT=64641
2018/01/22 03:38:18 AWS_ACCESS_KEY=[REDACTED]
2018/01/22 03:38:18 AWS_ACCESS_KEY_ID=[REDACTED]
2018/01/22 03:38:18 AWS_SECRET_KEY=[REDACTED]
2018/01/22 03:38:18 AWS_SECRET_ACCESS_KEY=[REDACTED]
2018/01/22 03:38:18 AWS_SESSION_TOKEN=[REDACTED]
2018/01/22 03:38:18 AWS_SECURITY_TOKEN=[REDACTED]
2018/01/22 03:38:18 Printing args: [/var/task/main]
2018/01/22 03:38:18 Hostname:ip-10-12-246-191 and error:<nil>
main
END RequestId: af8c002a-ff25-11e7-ad85-297f734c4d1d
REPORT RequestId: af8c002a-ff25-11e7-ad85-297f734c4d1d Duration: 15.79 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 20 MB
#include<iostream>
int main() {
std::cout << "Hi there from a C++ program" << std::endl;
}
package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"runtime"
"github.com/aws/aws-lambda-go/lambda"
)
func Handler() {
log.Println("Golang version is this:", runtime.Version())
log.Println("Number of CPUs is:", runtime.NumCPU())
log.Println("printing environment variables")
for _, env := range os.Environ() {
log.Println(env)
}
log.Println("Printing args:", os.Args)
host, err := os.Hostname()
log.Printf("Hostname:%v and error:%v\n", host, err)
files, err := ioutil.ReadDir("/var/task")
if err != nil {
log.Fatal(err)
}
for _, f := range files {
fmt.Println(f.Name())
}
}
func main() {
lambda.Start(Handler)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment