awslabs / aws-lambda-cpp

C++ implementation of the AWS Lambda runtime
Apache License 2.0
440 stars 88 forks source link

Question about timeouts #119

Open joscul opened 3 years ago

joscul commented 3 years ago

Hello,

I have followed the examples here: https://aws.amazon.com/blogs/compute/introducing-the-c-lambda-runtime/

When I run my internal execution so that it takes 5 seconds everything works fine. But when I run it for 70 seconds I never get any response and the lambda function seems to be restarting several times. My guess is that is has to do with some timeouts. But how do I configure them? I cannot find any good developer reference.

static invocation_response my_handler(invocation_request const& req, Aws::S3::S3Client const& client) {
    using namespace Aws::Utils::Json;
    JsonValue json(req.payload);
    if (!json.WasParseSuccessful()) {
        return invocation_response::failure("Failed to parse input JSON", "InvalidJSON");
    }

    auto v = json.View();

    if (!v.ValueExists("s3bucket") || !v.ValueExists("s3key") || !v.GetObject("s3bucket").IsString() ||
        !v.GetObject("s3key").IsString()) {
        return invocation_response::failure("Missing input value s3bucket or s3key", "InvalidJSON");
    }

    auto bucket = v.GetString("s3bucket");
    auto key = v.GetString("s3key");

    AWS_LOGSTREAM_INFO(TAG, "Attempting to download file from s3://" << bucket << "/" << key);

    // Internal execution about 70 seconds...
       string response = "Success!";

    return invocation_response::success("We did it! Response: " + response, "application/json");
}

std::function<std::shared_ptr<Aws::Utils::Logging::LogSystemInterface>()> GetConsoleLoggerFactory() {
    return [] {
        return Aws::MakeShared<Aws::Utils::Logging::ConsoleLogSystem>(
            "console_logger", Aws::Utils::Logging::LogLevel::Info);
    };
}

Aws::Client::ClientConfiguration getS3Config() {

    Aws::Client::ClientConfiguration config;
    config.region = "us-east-1";
    config.scheme = Aws::Http::Scheme::HTTP;

    return config;
}

Aws::Client::ClientConfiguration getS3ConfigWithBundle() {

    cout << "USING S3 REGION: " << Aws::Environment::GetEnv("AWS_REGION") << endl;

    Aws::Client::ClientConfiguration config;
    config.region = Aws::Environment::GetEnv("AWS_REGION");
    config.scheme = Aws::Http::Scheme::HTTP;

    return config;
}

void run_lambda_handler() {

    Aws::S3::S3Client client(getS3ConfigWithBundle());
    auto handler_fn = [&client](aws::lambda_runtime::invocation_request const& req) {
        return my_handler(req, client);
    };
    run_handler(handler_fn);
}

int main(int argc, const char **argv) {
    Aws::SDKOptions options;
    options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Info;
    options.loggingOptions.logger_create_fn = GetConsoleLoggerFactory();
    Aws::InitAPI(options);

    run_lambda_handler();

    Aws::ShutdownAPI(options);

    return 0;
}
marcomagdy commented 3 years ago

Can you paste the logs from cloud watch?

joscul commented 3 years ago

Hello,

Yes hera are the logs from one of those runs, nothing unusual it just restarts three times from one invokation:


No older events at this moment. Retry
--
  | 2021-04-21T12:31:29.862+02:00 | START RequestId: ebfa388c-7b20-4c1a-9ed8-33170026e4bf Version: $LATEST
  | 2021-04-21T12:31:29.862+02:00 | [INFO] 2021-04-21 10:31:29.855 Aws_Init_Cleanup [140060645824192] Initiate AWS SDK for C++ with Version:1.9.1
  | 2021-04-21T12:31:29.862+02:00 | [TRACE] 2021-04-21 10:31:29.859 FileSystemUtils [140060645824192] Checking HOME for the home directory.
  | 2021-04-21T12:31:29.862+02:00 | [DEBUG] 2021-04-21 10:31:29.859 FileSystemUtils [140060645824192] Environment value for variable HOME is
  | 2021-04-21T12:31:29.862+02:00 | [WARN] 2021-04-21 10:31:29.859 FileSystemUtils [140060645824192] Home dir not stored in environment, trying to fetch manually from the OS.
  | 2021-04-21T12:31:29.862+02:00 | [INFO] 2021-04-21 10:31:29.862 FileSystemUtils [140060645824192] Pulled /home/sbx_user1051 as home directory from the OS.
  | 2021-04-21T12:31:29.862+02:00 | [DEBUG] 2021-04-21 10:31:29.862 FileSystemUtils [140060645824192] Home directory is missing the final / appending one to normalize
  | 2021-04-21T12:31:29.862+02:00 | [DEBUG] 2021-04-21 10:31:29.862 FileSystemUtils [140060645824192] Final Home Directory is /home/sbx_user1051/
  | 2021-04-21T12:31:29.862+02:00 | [INFO] 2021-04-21 10:31:29.862 Aws::Config::AWSConfigFileProfileConfigLoader [140060645824192] Initializing config loader against fileName /home/sbx_user1051/.aws/credentials and using profilePrefix = 0
  | 2021-04-21T12:31:29.862+02:00 | [TRACE] 2021-04-21 10:31:29.862 FileSystemUtils [140060645824192] Checking HOME for the home directory.
  | 2021-04-21T12:31:29.862+02:00 | [DEBUG] 2021-04-21 10:31:29.862 FileSystemUtils [140060645824192] Environment value for variable HOME is
  | 2021-04-21T12:31:29.862+02:00 | [WARN] 2021-04-21 10:31:29.862 FileSystemUtils [140060645824192] Home dir not stored in environment, trying to fetch manually from the OS.
  | 2021-04-21T12:31:29.862+02:00 | [INFO] 2021-04-21 10:31:29.862 FileSystemUtils [140060645824192] Pulled /home/sbx_user1051 as home directory from the OS.
  | 2021-04-21T12:31:29.862+02:00 | [DEBUG] 2021-04-21 10:31:29.862 FileSystemUtils [140060645824192] Home directory is missing the final / appending one to normalize
  | 2021-04-21T12:31:29.862+02:00 | [DEBUG] 2021-04-21 10:31:29.862 FileSystemUtils [140060645824192] Final Home Directory is /home/sbx_user1051/
  | 2021-04-21T12:31:29.862+02:00 | [INFO] 2021-04-21 10:31:29.862 Aws::Config::AWSConfigFileProfileConfigLoader [140060645824192] Initializing config loader against fileName /home/sbx_user1051/.aws/config and using profilePrefix = 1
  | 2021-04-21T12:31:29.862+02:00 | [TRACE] 2021-04-21 10:31:29.862 FileSystemUtils [140060645824192] Checking HOME for the home directory.
  | 2021-04-21T12:31:29.862+02:00 | [DEBUG] 2021-04-21 10:31:29.862 FileSystemUtils [140060645824192] Environment value for variable HOME is
  | 2021-04-21T12:31:29.862+02:00 | [WARN] 2021-04-21 10:31:29.862 FileSystemUtils [140060645824192] Home dir not stored in environment, trying to fetch manually from the OS.
  | 2021-04-21T12:31:29.862+02:00 | [INFO] 2021-04-21 10:31:29.862 FileSystemUtils [140060645824192] Pulled /home/sbx_user1051 as home directory from the OS.
  | 2021-04-21T12:31:29.862+02:00 | [DEBUG] 2021-04-21 10:31:29.862 FileSystemUtils [140060645824192] Home directory is missing the final / appending one to normalize
  | 2021-04-21T12:31:29.862+02:00 | [DEBUG] 2021-04-21 10:31:29.862 FileSystemUtils [140060645824192] Final Home Directory is /home/sbx_user1051/
  | 2021-04-21T12:31:29.862+02:00 | [INFO] 2021-04-21 10:31:29.862 Aws::Config::AWSConfigFileProfileConfigLoader [140060645824192] Unable to open config file /home/sbx_user1051/.aws/credentials for reading.
  | 2021-04-21T12:31:29.862+02:00 | [INFO] 2021-04-21 10:31:29.862 Aws::Config::AWSProfileConfigLoader [140060645824192] Failed to reload configuration.
  | 2021-04-21T12:31:29.862+02:00 | [TRACE] 2021-04-21 10:31:29.862 FileSystemUtils [140060645824192] Checking HOME for the home directory.
  | 2021-04-21T12:31:29.862+02:00 | [DEBUG] 2021-04-21 10:31:29.862 FileSystemUtils [140060645824192] Environment value for variable HOME is
  | 2021-04-21T12:31:29.862+02:00 | [WARN] 2021-04-21 10:31:29.862 FileSystemUtils [140060645824192] Home dir not stored in environment, trying to fetch manually from the OS.
  | 2021-04-21T12:31:29.862+02:00 | [INFO] 2021-04-21 10:31:29.862 FileSystemUtils [140060645824192] Pulled /home/sbx_user1051 as home directory from the OS.
  | 2021-04-21T12:31:29.862+02:00 | [DEBUG] 2021-04-21 10:31:29.862 FileSystemUtils [140060645824192] Home directory is missing the final / appending one to normalize
  | 2021-04-21T12:31:29.862+02:00 | [DEBUG] 2021-04-21 10:31:29.862 FileSystemUtils [140060645824192] Final Home Directory is /home/sbx_user1051/
  | 2021-04-21T12:31:29.862+02:00 | [INFO] 2021-04-21 10:31:29.862 Aws::Config::AWSConfigFileProfileConfigLoader [140060645824192] Unable to open config file /home/sbx_user1051/.aws/config for reading.
  | 2021-04-21T12:31:29.862+02:00 | [INFO] 2021-04-21 10:31:29.862 Aws::Config::AWSProfileConfigLoader [140060645824192] Failed to reload configuration.
  | 2021-04-21T12:31:29.874+02:00 | [INFO] 2021-04-21 10:31:29.862 event-loop [140060645824192] id=0x555557144b00: Initializing edge-triggered epoll
  | 2021-04-21T12:31:29.874+02:00 | [INFO] 2021-04-21 10:31:29.862 event-loop [140060645824192] id=0x555557144b00: Using eventfd for cross-thread notifications.
  | 2021-04-21T12:31:29.874+02:00 | [TRACE] 2021-04-21 10:31:29.862 event-loop [140060645824192] id=0x555557144b00: eventfd descriptor 5.
  | 2021-04-21T12:31:29.874+02:00 | [INFO] 2021-04-21 10:31:29.862 event-loop [140060645824192] id=0x555557144b00: Starting event-loop thread.
  | 2021-04-21T12:31:29.874+02:00 | [INFO] 2021-04-21 10:31:29.862 dns [140060645824192] id=0x555557144e80: Initializing default host resolver with 8 max host entries.
  | 2021-04-21T12:31:29.874+02:00 | [INFO] 2021-04-21 10:31:29.862 channel-bootstrap [140060645824192] id=0x555557147360: Initializing client bootstrap with event-loop group 0x55555713c780
  | 2021-04-21T12:31:29.874+02:00 | [INFO] 2021-04-21 10:31:29.862 event-loop [140060645725952] id=0x555557144b00: main loop started
  | 2021-04-21T12:31:29.874+02:00 | [TRACE] 2021-04-21 10:31:29.862 event-loop [140060645725952] id=0x555557144b00: subscribing to events on fd 5
  | 2021-04-21T12:31:29.874+02:00 | [INFO] 2021-04-21 10:31:29.862 event-loop [140060645725952] id=0x555557144b00: default timeout 100000, and max events to process per tick 100
  | 2021-04-21T12:31:29.874+02:00 | [TRACE] 2021-04-21 10:31:29.862 event-loop [140060645725952] id=0x555557144b00: waiting for a maximum of 100000 ms
  | 2021-04-21T12:31:29.874+02:00 | [INFO] 2021-04-21 10:31:29.873 CurlHttpClient [140060645824192] Initializing Curl library with version: 7.68.0, ssl version: OpenSSL/1.1.1f
  | 2021-04-21T12:31:29.874+02:00 | [DEBUG] 2021-04-21 10:31:29.873 ClientConfiguration [140060645824192] ClientConfiguration will use SDK Auto Resolved profile: [default] if not specified by users.
  | 2021-04-21T12:31:29.874+02:00 | [WARN] 2021-04-21 10:31:29.873 ClientConfiguration [140060645824192] Retry Strategy will use the default max attempts.
  | 2021-04-21T12:31:29.874+02:00 | [INFO] 2021-04-21 10:31:29.873 EC2MetadataClient [140060645824192] Creating AWSHttpResourceClient with max connections 2 and scheme http
  | 2021-04-21T12:31:29.874+02:00 | [INFO] 2021-04-21 10:31:29.873 CurlHandleContainer [140060645824192] Initializing CurlHandleContainer with size 2
  | 2021-04-21T12:31:29.876+02:00 | USING S3 REGION: us-east-1
  | 2021-04-21T12:31:29.876+02:00 | [DEBUG] 2021-04-21 10:31:29.873 ClientConfiguration [140060645824192] ClientConfiguration will use SDK Auto Resolved profile: [default] if not specified by users.
  | 2021-04-21T12:31:29.876+02:00 | [WARN] 2021-04-21 10:31:29.873 ClientConfiguration [140060645824192] Retry Strategy will use the default max attempts.
  | 2021-04-21T12:31:29.876+02:00 | [TRACE] 2021-04-21 10:31:29.876 FileSystemUtils [140060645824192] Checking HOME for the home directory.
  | 2021-04-21T12:31:29.876+02:00 | [DEBUG] 2021-04-21 10:31:29.876 FileSystemUtils [140060645824192] Environment value for variable HOME is
  | 2021-04-21T12:31:29.876+02:00 | [WARN] 2021-04-21 10:31:29.876 FileSystemUtils [140060645824192] Home dir not stored in environment, trying to fetch manually from the OS.
  | 2021-04-21T12:31:29.876+02:00 | [INFO] 2021-04-21 10:31:29.876 FileSystemUtils [140060645824192] Pulled /home/sbx_user1051 as home directory from the OS.
  | 2021-04-21T12:31:29.876+02:00 | [DEBUG] 2021-04-21 10:31:29.876 FileSystemUtils [140060645824192] Home directory is missing the final / appending one to normalize
  | 2021-04-21T12:31:29.876+02:00 | [DEBUG] 2021-04-21 10:31:29.876 FileSystemUtils [140060645824192] Final Home Directory is /home/sbx_user1051/
  | 2021-04-21T12:31:29.876+02:00 | [INFO] 2021-04-21 10:31:29.876 Aws::Config::AWSConfigFileProfileConfigLoader [140060645824192] Initializing config loader against fileName /home/sbx_user1051/.aws/credentials and using profilePrefix = 0
  | 2021-04-21T12:31:29.876+02:00 | [TRACE] 2021-04-21 10:31:29.876 FileSystemUtils [140060645824192] Checking HOME for the home directory.
  | 2021-04-21T12:31:29.876+02:00 | [DEBUG] 2021-04-21 10:31:29.876 FileSystemUtils [140060645824192] Environment value for variable HOME is
  | 2021-04-21T12:31:29.876+02:00 | [WARN] 2021-04-21 10:31:29.876 FileSystemUtils [140060645824192] Home dir not stored in environment, trying to fetch manually from the OS.
  | 2021-04-21T12:31:29.876+02:00 | [INFO] 2021-04-21 10:31:29.876 FileSystemUtils [140060645824192] Pulled /home/sbx_user1051 as home directory from the OS.
  | 2021-04-21T12:31:29.876+02:00 | [DEBUG] 2021-04-21 10:31:29.876 FileSystemUtils [140060645824192] Home directory is missing the final / appending one to normalize
  | 2021-04-21T12:31:29.876+02:00 | [DEBUG] 2021-04-21 10:31:29.876 FileSystemUtils [140060645824192] Final Home Directory is /home/sbx_user1051/
  | 2021-04-21T12:31:29.876+02:00 | [TRACE] 2021-04-21 10:31:29.876 FileSystemUtils [140060645824192] Checking HOME for the home directory.
  | 2021-04-21T12:31:29.876+02:00 | [DEBUG] 2021-04-21 10:31:29.876 FileSystemUtils [140060645824192] Environment value for variable HOME is
  | 2021-04-21T12:31:29.876+02:00 | [WARN] 2021-04-21 10:31:29.876 FileSystemUtils [140060645824192] Home dir not stored in environment, trying to fetch manually from the OS.
  | 2021-04-21T12:31:29.876+02:00 | [INFO] 2021-04-21 10:31:29.876 FileSystemUtils [140060645824192] Pulled /home/sbx_user1051 as home directory from the OS.
  | 2021-04-21T12:31:29.876+02:00 | [DEBUG] 2021-04-21 10:31:29.876 FileSystemUtils [140060645824192] Home directory is missing the final / appending one to normalize
  | 2021-04-21T12:31:29.876+02:00 | [DEBUG] 2021-04-21 10:31:29.876 FileSystemUtils [140060645824192] Final Home Directory is /home/sbx_user1051/
  | 2021-04-21T12:31:29.876+02:00 | [INFO] 2021-04-21 10:31:29.876 ProfileConfigFileAWSCredentialsProvider [140060645824192] Setting provider to read credentials from /home/sbx_user1051/.aws/credentials for credentials file and /home/sbx_user1051/.aws/config for the config file , for use with profile default
  | 2021-04-21T12:31:29.876+02:00 | [INFO] 2021-04-21 10:31:29.876 ProcessCredentialsProvider [140060645824192] Setting process credentials provider to read config from default
  | 2021-04-21T12:31:29.876+02:00 | [WARN] 2021-04-21 10:31:29.876 STSAssumeRoleWithWebIdentityCredentialsProvider [140060645824192] Token file must be specified to use STS AssumeRole web identity creds provider.
  | 2021-04-21T12:31:29.876+02:00 | [INFO] 2021-04-21 10:31:29.876 SSOCredentialsProvider [140060645824192] Setting sso credentials provider to read config from default
  | 2021-04-21T12:31:29.876+02:00 | [DEBUG] 2021-04-21 10:31:29.876 DefaultAWSCredentialsProviderChain [140060645824192] The environment variable value AWS_CONTAINER_CREDENTIALS_RELATIVE_URI is
  | 2021-04-21T12:31:29.876+02:00 | [DEBUG] 2021-04-21 10:31:29.876 DefaultAWSCredentialsProviderChain [140060645824192] The environment variable value AWS_CONTAINER_CREDENTIALS_FULL_URI is
  | 2021-04-21T12:31:29.876+02:00 | [DEBUG] 2021-04-21 10:31:29.876 DefaultAWSCredentialsProviderChain [140060645824192] The environment variable value AWS_EC2_METADATA_DISABLED is
  | 2021-04-21T12:31:29.876+02:00 | [DEBUG] 2021-04-21 10:31:29.876 ClientConfiguration [140060645824192] ClientConfiguration will use SDK Auto Resolved profile: [default] if not specified by users.
  | 2021-04-21T12:31:29.876+02:00 | [WARN] 2021-04-21 10:31:29.876 ClientConfiguration [140060645824192] Retry Strategy will use the default max attempts.
  | 2021-04-21T12:31:29.881+02:00 | [INFO] 2021-04-21 10:31:29.876 EC2MetadataClient [140060645824192] Creating AWSHttpResourceClient with max connections 2 and scheme http
  | 2021-04-21T12:31:29.881+02:00 | [INFO] 2021-04-21 10:31:29.876 CurlHandleContainer [140060645824192] Initializing CurlHandleContainer with size 2
  | 2021-04-21T12:31:29.881+02:00 | [INFO] 2021-04-21 10:31:29.876 InstanceProfileCredentialsProvider [140060645824192] Creating Instance with default EC2MetadataClient and refresh rate 300000
  | 2021-04-21T12:31:29.881+02:00 | [INFO] 2021-04-21 10:31:29.876 DefaultAWSCredentialsProviderChain [140060645824192] Added EC2 metadata service credentials provider to the provider chain.
  | 2021-04-21T12:31:29.881+02:00 | [DEBUG] 2021-04-21 10:31:29.876 EnvironmentAWSCredentialsProvider [140060645824192] Found credential in environment with access key id ASIAQFQTS34JUTVPY4Z4
  | 2021-04-21T12:31:29.881+02:00 | [INFO] 2021-04-21 10:31:29.876 EnvironmentAWSCredentialsProvider [140060645824192] Found secret key
  | 2021-04-21T12:31:29.881+02:00 | [INFO] 2021-04-21 10:31:29.876 EnvironmentAWSCredentialsProvider [140060645824192] Found sessionToken
  | 2021-04-21T12:31:29.881+02:00 | [INFO] 2021-04-21 10:31:29.876 CurlHandleContainer [140060645824192] Initializing CurlHandleContainer with size 25
  | 2021-04-21T12:31:29.881+02:00 | [TRACE] 2021-04-21 10:31:29.880 event-loop [140060645725952] id=0x555557144b00: wake up with -1 events to process.
  | 2021-04-21T12:31:29.881+02:00 | [TRACE] 2021-04-21 10:31:29.880 event-loop [140060645725952] id=0x555557144b00: running scheduled tasks.
  | 2021-04-21T12:31:29.881+02:00 | [TRACE] 2021-04-21 10:31:29.880 event-loop [140060645725952] id=0x555557144b00: no more scheduled tasks using default timeout.
  | 2021-04-21T12:31:29.881+02:00 | [TRACE] 2021-04-21 10:31:29.880 event-loop [140060645725952] id=0x555557144b00: waiting for a maximum of 100000 ms
  | 2021-04-21T12:31:29.881+02:00 | [INFO] 2021-04-21 10:31:29.881 LAMBDA_ALLOC [140060645824192] Attempting to download file from s3://commoncrawl/crawl-data/CC-MAIN-2021-10/segments/1614178389798.91/warc/CC-MAIN-20210309092230-20210309122230-00583.warc.gz
  | 2021-04-21T12:31:29.881+02:00 | Sleeping for 70 seconds
  | 2021-04-21T12:32:39.883+02:00 | END RequestId: ebfa388c-7b20-4c1a-9ed8-33170026e4bf
  | 2021-04-21T12:32:39.883+02:00 | REPORT RequestId: ebfa388c-7b20-4c1a-9ed8-33170026e4bf Duration: 70001.72 ms Billed Duration: 70254 ms Memory Size: 512 MB Max Memory Used: 57 MB Init Duration: 252.16 ms
  | 2021-04-21T12:33:31.711+02:00 | START RequestId: f8b96316-214c-468e-ba1e-9d0d3a2a6a25 Version: $LATEST
  | 2021-04-21T12:33:31.714+02:00 | [TRACE] 2021-04-21 10:33:31.711 event-loop [140060645725952] id=0x555557144b00: wake up with -1 events to process.
  | 2021-04-21T12:33:31.714+02:00 | [TRACE] 2021-04-21 10:33:31.711 event-loop [140060645725952] id=0x555557144b00: running scheduled tasks.
  | 2021-04-21T12:33:31.714+02:00 | [TRACE] 2021-04-21 10:33:31.711 event-loop [140060645725952] id=0x555557144b00: no more scheduled tasks using default timeout.
  | 2021-04-21T12:33:31.714+02:00 | [TRACE] 2021-04-21 10:33:31.711 event-loop [140060645725952] id=0x555557144b00: waiting for a maximum of 100000 ms
  | 2021-04-21T12:33:31.714+02:00 | [INFO] 2021-04-21 10:33:31.714 LAMBDA_ALLOC [140060645824192] Attempting to download file from s3://commoncrawl/crawl-data/CC-MAIN-2021-10/segments/1614178389798.91/warc/CC-MAIN-20210309092230-20210309122230-00583.warc.gz
  | 2021-04-21T12:33:31.714+02:00 | Sleeping for 70 seconds
  | 2021-04-21T12:34:41.715+02:00 | END RequestId: f8b96316-214c-468e-ba1e-9d0d3a2a6a25
  | 2021-04-21T12:34:41.715+02:00 | REPORT RequestId: f8b96316-214c-468e-ba1e-9d0d3a2a6a25 Duration: 70001.13 ms Billed Duration: 70002 ms Memory Size: 512 MB Max Memory Used: 57 MB
  | 2021-04-21T12:35:37.884+02:00 | START RequestId: d55b2cee-d203-4dd6-b148-1edb2b8e6412 Version: $LATEST
  | 2021-04-21T12:35:37.887+02:00 | [TRACE] 2021-04-21 10:35:37.884 event-loop [140060645725952] id=0x555557144b00: wake up with -1 events to process.
  | 2021-04-21T12:35:37.887+02:00 | [TRACE] 2021-04-21 10:35:37.884 event-loop [140060645725952] id=0x555557144b00: running scheduled tasks.
  | 2021-04-21T12:35:37.887+02:00 | [TRACE] 2021-04-21 10:35:37.884 event-loop [140060645725952] id=0x555557144b00: no more scheduled tasks using default timeout.
  | 2021-04-21T12:35:37.887+02:00 | [TRACE] 2021-04-21 10:35:37.884 event-loop [140060645725952] id=0x555557144b00: waiting for a maximum of 100000 ms
  | 2021-04-21T12:35:37.887+02:00 | [INFO] 2021-04-21 10:35:37.887 LAMBDA_ALLOC [140060645824192] Attempting to download file from s3://commoncrawl/crawl-data/CC-MAIN-2021-10/segments/1614178389798.91/warc/CC-MAIN-20210309092230-20210309122230-00583.warc.gz
  | 2021-04-21T12:35:37.887+02:00 | Sleeping for 70 seconds
  | 2021-04-21T12:36:47.890+02:00 | END RequestId: d55b2cee-d203-4dd6-b148-1edb2b8e6412
  | 2021-04-21T12:36:47.890+02:00 | REPORT RequestId: d55b2cee-d203-4dd6-b148-1edb2b8e6412 Duration: 70001.07 ms Billed Duration: 70002 ms Memory Size: 512 MB Max Memory Used: 57 MB
marcomagdy commented 3 years ago

The logs show the AWS SDK attempting to read configuration from the local filesystem.

[INFO] 2021-04-21 10:31:29.876 ProfileConfigFileAWSCredentialsProvider [140060645824192] Setting provider to read credentials from /home/sbx_user1051/.aws/credentials for credentials file and /home/sbx_user1051/.aws/config for the config file , for use with profile default

I suggest you use the environment credential provider as in https://github.com/awslabs/aws-lambda-cpp/blob/master/examples/s3/main.cpp#L76. And make sure you set up the environment variables in Lambda.

specious commented 2 years ago

The logs look like three successful invocations (the first one being a cold start) that each complete in about 70 seconds and return.