Git Product home page Git Product logo

aws-sdk-cpp's Introduction

AWS SDK for C++

The AWS SDK for C++ provides a modern C++ (version C++ 11 or later) interface for Amazon Web Services (AWS). It is meant to be performant and fully functioning with low- and high-level SDKs, while minimizing dependencies and providing platform portability (Windows, OSX, Linux, and mobile).

AWS SDK for C++ is now in General Availability and recommended for production use. We invite our customers to join the development efforts by submitting pull requests and sending us feedback and ideas via GitHub Issues.

Jump To:

Getting Started

Building the SDK:

Minimum Requirements:

  • Visual Studio 2015 or later
  • OR GNU Compiler Collection (GCC) 4.9 or later
  • OR Clang 3.3 or later
  • 4GB of RAM (required for building some of the larger clients; SDK build may fail on EC2 instance types t2.micro, t2.small, and other small instance types due to insufficient memory)
  • Supported platforms
    • Amazon Linux
    • Windows
    • Mac

Building From Source:

To create an out-of-source build:

  1. Install CMake and the relevant build tools for your platform. Ensure these are available in your executable path.

  2. Clone this repository with submodules

    git clone --recurse-submodules https://github.com/aws/aws-sdk-cpp
  3. Create your build directory. Replace <BUILD_DIR> with your build directory name:

  4. Build the project:

    cd <BUILD_DIR>
    cmake <path-to-root-of-this-source-code> \
    -DCMAKE_BUILD_TYPE=Debug \
    -DCMAKE_INSTALL_PREFIX=<path-to-install> \
    -DBUILD_ONLY="s3"
    cmake --build . --config=Debug
    cmake --install . --config=Debug

    NOTE: BUILD_ONLY is an optional flag used to list only the services you are using. Building the whole SDK can take a long time. Also, check out the list of CMake parameters

Other Dependencies:

To compile in Linux, you must have the header files for libcurl, libopenssl. The packages are typically available in your package manager.

Debian based Linux distributions example: sudo apt-get install libcurl-dev

RPM based Linux distributions example: sudo [yum|dnf|zypper] install libcurl-devel

Building for MacOS

Building for macOS is largely the same as building on a *nix system except for how the system consumes the curl dependency and compilers.

You must install the xcode command line tools. This is required for Apple clang and gcc. This also installs libcurl as well.

⚠️ If you are using macOS Sonoma, there is a known issue where using libcurl version 8.4.0 on macOS can lead to issues. This issue is being tracked with curl and Apple. In the meanwhile, please use an updated version of curl from Homebrew. You can include this in your project via the CMAKE_PREFIX_PATH.

cmake -DCMAKE_PREFIX_PATH="/opt/homebrew/opt/curl/" \
 -DAUTORUN_UNIT_TESTS=OFF \
 -DBUILD_ONLY="s3" \
 -DCMAKE_INSTALL_PREFIX="~/sdk-install" \
 ..

Building for Android

To build for Android, add -DTARGET_ARCH=ANDROID to your CMake command line. Currently, we support Android APIs from 19 to 28 with Android NDK 19c, and we are using the built-in CMake toolchain file supplied by Android NDK, assuming you have the appropriate environment variables (ANDROID_NDK) set.

Android on Windows

Building for Android on Windows requires some additional setup. In particular, you will need to run CMake from a Visual Studio developer command prompt (2015 or higher). Additionally, you will need 'git' and 'patch' in your path. If you have Git installed on a Windows system, then the patch is likely found in a sibling directory (.../Git/usr/bin/). Once you've verified these requirements, your CMake command line will change slightly to use nmake:

cmake -G "NMake Makefiles" `-DTARGET_ARCH=ANDROID` <other options> ..

Nmake builds targets in a serial fashion. To make things quicker, we recommend installing JOM as an alternative to nmake and then changing the CMake invocation to:

cmake -G "NMake Makefiles JOM" `-DTARGET_ARCH=ANDROID` <other options> ..

Building aws-sdk-cpp - Using vcpkg

You can download and install aws-sdk-cpp using the vcpkg dependency manager:

git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
./vcpkg install aws-sdk-cpp

The aws-sdk-cpp port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please create an issue or pull request on the vcpkg repository.

Maintenance and support for SDK major versions

For information about maintenance and support for SDK major versions and our underlying dependencies, see the following in the AWS SDKs and Tools Shared Configuration and Credentials Reference Guide

Getting Help

The best way to interact with our team is through GitHub. You can open a discussion for guidance questions or an issue for bug reports or feature requests.

You may also find help on community resources such as StackOverFlow with the tag #aws-sdk-cpp. If you have a support plan with AWS Support, you can also create a new support case.

Please make sure to check out our resources too before opening an issue:

Using the SDK and Other Topics

aws-sdk-cpp's People

Contributors

aws-sdk-cpp-automation avatar baxeaz avatar bretambrose avatar dependabot[bot] avatar diablodale avatar dmitriymusatkin avatar fabregaszy avatar graebm avatar grrtrr avatar haocheng-aws avatar hunjmes avatar jeking3 avatar jmklix avatar jonathanhenson avatar kaibalopez avatar marcomagdy avatar meyertst-aws avatar michaelt32m avatar rwie-aws avatar sbiscigl avatar sdavtaker avatar sergeyryabinin avatar singku avatar singku-china avatar supermassive avatar whoenig avatar wps132230 avatar xkszltl avatar yasminetalby avatar zeliard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aws-sdk-cpp's Issues

Adding dimensions to metrics in PutMetricDataRequest results in a MalformedInput exception

When constructing a MetricDatum for CloudWatch, it seems that adding any dimensions to the metric will result in errors upon attempting to submit the data to CloudWatch via the CloudWatchClient.PutMetricData(...) function.

It looks like the issue is that the output format generated by the CloudWatchClient does not match the specification here:

https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_PutMetricData.html

The code below generates the following request body:

Action=PutMetricData
&Namespace=MyMetricTest
&MetricData.member.1.MetricName=MyMetricName
&MetricData.member.1.Dimensions.Name=MyDimensionName
&MetricData.member.1.Dimensions.Value=MyDimensionValue
&MetricData.member.1.Value=100
&Version=2010-08-01

But according to the specification, it looks like it should actually be generating this request body instead (Notice the extra ".member.1" after the "Dimensions" string):

Action=PutMetricData
&Namespace=MyMetricTest
&MetricData.member.1.MetricName=MyMetricName
&MetricData.member.1.Dimensions.member.1.Name=MyDimensionName
&MetricData.member.1.Dimensions.member.1.Value=MyDimensionValue
&MetricData.member.1.Value=100
&Version=2010-08-01

Here is a code snippet to fully reproduce the issue:

#include <iostream>

#include "aws/core/auth/AWSCredentialsProvider.h"
#include "aws/monitoring/CloudWatchClient.h"
#include "aws/monitoring/model/PutMetricDataRequest.h"

using namespace Aws;
using namespace Aws::Auth;
using namespace Aws::CloudWatch;
using namespace Aws::CloudWatch::Model;
using namespace Aws::Http;
using namespace Aws::Client;
using namespace std::chrono;

int main()
{
    /*
    This code results in the following output:

    ERROR: MalformedInput::Unable to parse ExceptionName: MalformedInput Message: Unexpected complex element termination
    Transmission failure
    */

    const char* accessKey = "MY_ACCESS_KEY";
    const char* secretKey = "MY_SECRET_KEY";

    AWSCredentials basicCreds(accessKey, secretKey);
    CloudWatchClient client = CloudWatchClient(basicCreds);
    PutMetricDataRequest request;
    request.SetNamespace("MyMetricTest");

    MetricDatum datum;
    datum.SetMetricName("MyMetricName");
    datum.SetValue(100.0);

    Dimension dim;
    dim.SetName("MyDimensionName");
    dim.SetValue("MyDimensionValue");

    //This line is the problem!
    datum.AddDimensions(dim);

    Aws::Vector<MetricDatum> metrics;
    metrics.push_back(datum);
    request.SetMetricData(metrics);

    char requestDump[4096];
    request.GetBody()->getline(requestDump,4096);
    std::cout << "REQUEST = " << requestDump << std::endl;

    PutMetricDataOutcome outcome = client.PutMetricData(request);
    if (!outcome.IsSuccess())
    {
        std::cout << "ERROR: " << outcome.GetError().GetExceptionName() << "::" << outcome.GetError().GetMessage() << std::endl;
    }
    std::cout << "Transmission " << (outcome.IsSuccess() ? "success" : "failure") << std::endl;

    char dummy[256];
    std::cin.getline(dummy, 256);
}

This repo is too big

Do one thing well. Break concerns into smaller, more general purpose repos; they will be easier to reason about and test. Also, this is awesome.

Please export() the CMake targets and add include directories to them

Hi,

I'd like to consume the SDK from my own CMake project without having to install it (I detest having to install libraries into my global system directories just to compile against them).

Fortunately, CMake makes it quite easy to consume a library that's also built with CMake from its build directory, if you prep the CMakeLists file correctly.

I'd just need two things:

  • Specify the include directories for each module--and I could live without those because I can fix those in my own CMakeLists file.
  • But the thing that I really need, is that you export() the targets in your top-level CMakeLists file.

The command looks like this:

export(TARGETS
    aws-cpp-sdk-s3
    aws-cpp-sdk-core
    ...
    FILE AwsCppSdkConfig.cmake)

Given this, if I build my project with:

cmake -DAwsCppSdk_DIR=/path/to/aws-sdk-cpp/build

Then in my own CMake file I can do this:

find_package(AwsCppSdk)
# Fix up the include directories of the targets that I found (wouldn't need to do this if you did it)
set_property(TARGET aws-cpp-sdk-core PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${AwsCppSdk_DIR}/../aws-cpp-sdk-core/include)
set_property(TARGET aws-cpp-sdk-s3 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${AwsCppSdk_DIR}/../aws-cpp-sdk-s3/include)

And now I can simply target_link_libraries against the libraries without having to specify anything else (transitive include and linker dependencies will be taken care of for me by CMake).

I'm in the process of compiling a guide to the most effective CMake usage. You can find it here:

http://rix0r.nl/blog/2015/08/13/cmake-guide/

Not able to compile for MinGW64

I am trying to compile using Mingw64 under MSys

Obviously it is not working because the cmake file under windows is tailored for msvc.

I removed the /Zi part in the CMakeList.test and added flags:

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")

I also changed target system to -G "MinGW Makefiles"

This improved situation but using mingw32-make is it still not working:
D:\Projects\awsapi\aws-sdk-cpp-master\aws-cpp-sdk-core\source\external\tinyxml2
tinyxml2.cpp:1639:15: error: definition of static data member 'Aws::External::ti
nyxml2::XMLDocument::_errorNames' of dllimport'd class
const char* XMLDocument::_errorNames[XML_ERROR_COUNT] = {
^
aws-cpp-sdk-core\CMakeFiles\aws-cpp-sdk-core.dir\build.make:187: recipe for targ
et 'aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/external/tinyxml2/ti
nyxml2.cpp.obj' failed

Thanks,
Nico.

Iterator-based APIs

From the readme:

a problem remains in that STL types dominate the public interface (primarily string parameters to the model object initialize/set methods). As it currently stands, developers that forgo STL entirely (rolling their own strings/containers/etc...) are forced to create many temporaries...

Should I be worried that you're not using the canonical C++ technique for working with generic strings and containers? The standard algorithms library is the perfect reference. The Boost String Algorithms library is another one.

At any rate, I am happy to finally see any kind of native API for AWS.

FileStream should flush on network operation complete

In gist I have code like this..

std::string filePath = "some/local/path";
std::shared_ptr<Aws::Http::HttpRequest>  request;
request->SetResponseStreamFactory(
        [&filePath, &offset]() -> Aws::IOStream* {
            constexpr auto OpenFlag = std::ios_base::out
                                    | std::ios_base::binary;
            Aws::IOStream* ofs =
                Aws::New<Aws::FStream>(ALLOCATION_TAG, filePath, OpenFlag);
            CHECK(ofs->good());
            CHECK(ofs->seekp(offset, ofs->beg));
            return ofs;
        });

std::shared_ptr<Aws::Http::HttpResponse> response(std::move(m_client->MakeRequest(*request)));

std::ifstream ifs(filePath); // ! DATA NOT YET FLUSHED TO FILE HERE

However if I artificially scope everything as follows...

std::string filePath = "some/local/path";
{ // BEGIN BOGUS SCOPE
std::shared_ptr<Aws::Http::HttpRequest>  request;
request->SetResponseStreamFactory(
        [&filePath, &offset]() -> Aws::IOStream* {
            constexpr auto OpenFlag = std::ios_base::out
                                    | std::ios_base::binary;
            Aws::IOStream* ofs =
                Aws::New<Aws::FStream>(ALLOCATION_TAG, filePath, OpenFlag);
            CHECK(ofs->good());
            CHECK(ofs->seekp(offset, ofs->beg));
            return ofs;
        });

std::shared_ptr<Aws::Http::HttpResponse> response(std::move(m_client->MakeRequest(*request)));
} // END BOGUS SCOPE 

std::ifstream ifs(filePath); // DATA IS NOW FLUSHED

This indicates to me a few things:

  • You're not flushing the file stream.
  • You're lazily deleting the Aws::IOstream object

This behavior is surprising and cost me ~45 minute of debug time.

This may /seem obvious/ in this contrived example. But the entire AWS SDK is designed using shared pointers practically everywhere, and as such... it can be come less clear in complicated code what the precise lifetime of objects will be.

Build fail on OS X El Capitan

I upgraded to:

  • OS X El Capitan 10.11.
  • Xcode 7.0.1.
  • $ clang++ -v
    Apple LLVM version 7.0.0 (clang-700.0.72)
    Target: x86_64-apple-darwin15.0.0
    Thread model: posix

I can run:

$ mkdir build
$ cd build
$ cmake ..

But the build fail shortly on the first openssl related source code:

$ make
Scanning dependencies of target aws-cpp-sdk-core
[  0%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/AmazonSerializableWebServiceRequest.cpp.o
[  0%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/AmazonStreamingWebServiceRequest.cpp.o
[  0%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/AmazonWebServiceRequest.cpp.o
[  0%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/Region.cpp.o
[  0%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/Version.cpp.o
[  0%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/external/tinyxml2/tinyxml2.cpp.o
[  0%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/external/json-cpp/jsoncpp.cpp.o
[  0%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/auth/AWSAuthSigner.cpp.o
[  0%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/auth/AWSCredentialsProvider.cpp.o
[  0%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/auth/AWSCredentialsProviderChain.cpp.o
[  1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/client/AWSClient.cpp.o
[  1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/client/AWSErrorMarshaller.cpp.o
[  1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/client/ClientConfiguration.cpp.o
[  1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/client/CoreErrors.cpp.o
[  1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/client/DefaultRetryStrategy.cpp.o
[  1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/internal/EC2MetadataClient.cpp.o
[  1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/http/HttpClientFactory.cpp.o
[  1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/http/HttpRequest.cpp.o
[  1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/http/HttpTypes.cpp.o
[  1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/http/Scheme.cpp.o
[  1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/http/URI.cpp.o
[  1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/http/standard/StandardHttpRequest.cpp.o
[  1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/http/standard/StandardHttpResponse.cpp.o
[  1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/http/curl/CurlHandleContainer.cpp.o
[  1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/http/curl/CurlHttpClient.cpp.o
[  1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/utils/DateTime.cpp.o
[  1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/utils/HashingUtils.cpp.o
[  1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/utils/OSVersionInfo.cpp.o
[  1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/utils/StringUtils.cpp.o
[  1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/utils/base64/Base64Shared.cpp.o
[  1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/utils/json/JsonSerializer.cpp.o
[  1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/utils/threading/Executor.cpp.o
[  1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/utils/xml/XmlSerializer.cpp.o
[  1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/utils/stream/ResponseStream.cpp.o
[  1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/utils/logging/AWSLogging.cpp.o
[  1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/utils/logging/ConsoleLogSystem.cpp.o
[  1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/utils/logging/DefaultLogSystem.cpp.o
[  2%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/utils/logging/FormattedLogSystem.cpp.o
[  2%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/utils/logging/LogLevel.cpp.o
[  2%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/utils/memory/AWSMemory.cpp.o
[  2%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/utils/base64/openssl/Base64.cpp.o
/Users/bu2/lab/aws/billing/beta/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/base64/openssl/Base64.cpp:18:10: fatal error: 'openssl/evp.h' file not found
#include <openssl/evp.h>
         ^
1 error generated.
make[2]: *** [aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/utils/base64/openssl/Base64.cpp.o] Error 1
make[1]: *** [aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/all] Error 2
make: *** [all] Error 2

What I can say for now:

  • Apple seems to have changed the way they package C/C++ headers. I don't have /usr/include anymore...
  • It seems they do not provide OpenSSL as developer library anymore.

Regards,

Bruno Le Hyaric.

Default Timeout is Surprising

Not sure if this is a bug, but rather it's an opinion. The default response timeout for Aws::Client::ClientConfiguration took me by surprise. It took me approximately 20 minutes to identify why all of my S3 downloads were failing.

It would be my expectation that the default timeout should be 0 (ie: No response timeout). Certainly the value of 3000 ms seems arbitrary.

This error message did help when I looked up libcurl errors (http://curl.haxx.se/libcurl/c/libcurl-errors.html)

[TRACE] 2015-12-08 01:31:05 CurlHttpClient [139876696389568] 16384 bytes written to response.
[ERROR] 2015-12-08 01:31:05 CurlHttpClient [139876696389568] Curl returned error code 28.
[DEBUG] 2015-12-08 01:31:05 CurlHandleContainer [139876696389568] Releasing curl handle 0x24cee90.
[DEBUG] 2015-12-08 01:31:05 CurlHandleContainer [139876696389568] Notifying waiting threads. 

Random Segmentation Fault in the SDK on first S3 request

Hi,

I am working on OS X Yosemite (10.10.5) with Xcode 7 and corresponding Clang/LLDB on a Mac Book Pro 13" of early 2015 (with force touch).

I made a simple program which:

  • create a S3Client
  • list objects from a specified S3 bucket
  • download one file from the bucket

And I get a "random" segmentation fault on the first S3 request (ListObjects). By random, I mean that it happens some time but other time, my program runs without problem. In fact, I realised that most of the time it happens right after computer startup (but I do not understand why...).

From the LLDB backtrace, I can say:

  • the EXC_BAD_ACCESS happens in a basic_string related operation
  • it might be related to AWS credentials lookup (I am not specifying my credentials, the SDK find those automatically from ~/.aws/credentials)

I will provide more details in following messages.

Regards,

Bruno Le Hyaric.

[Question] Lambda invocation - Communication security

Hi,

When a lambda function is invoked from a client application, are the input parameters for the function and the response from the function communicated using HTTPS?

I am confused, and I was wondering if someone could shed some light on this point. The AWS Lambda FAQ mentions that I would need to use API gateway and create Custom APIs to communicate with Lambda functions over HTTPS. However, I noticed that the C++ SDK allows initializing a Lamba client using a client-configuration with HTTPS scheme (see below for example). I also noticed that the default ClientConfiguration() uses HTTPS scheme as well (ClientConfiguration.cpp).

Aws::Client::ClientConfiguration config;
...
config.scheme = Scheme::HTTPS;
auto credentials = Aws::MakeShared<Aws::Auth::CognitoCachingAnonymousCredentialsProvider>("Example", "xxxxx", "ID-POOL");
Aws::Lambda::LambdaClient lambdaClient = Aws::Lambda::LambdaClient(credentials, config);

I would appreciate any information or resource on this. Thanks.

Some documentation ?

Hey,

it looks like you have done a greaaaat job !
But I need some documentation. I'm using EC2 and I don't really know what to write to manipulate instances..

Could you clarify the thing please ?

Thank you

Getting a Valgrind error

I don't know if I'm missing some define flags, but if I'm uderstanding everything correctly the SDK seems to be producing an error in Valgrind and the mistake looks legit.

==18132== Thread 3:
==18132== Mismatched free() / delete / delete []
==18132==    at 0x4C2D860: operator delete[](void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18132==    by 0x133400A: std::default_delete<unsigned char []>::operator()(unsigned char*) const (unique_ptr.h:119)
==18132==    by 0x1333776: std::unique_ptr<unsigned char, std::default_delete<unsigned char []> >::~unique_ptr() (unique_ptr.h:236)
==18132==    by 0x13333E7: Aws::Utils::Array<unsigned char>::~Array() (Array.h:39)
==18132==    by 0x1332F5E: Aws::Client::AWSAuthV4Signer::ComputePayloadHash(Aws::Http::HttpRequest&) const (AWSAuthSigner.cpp:339)
==18132==    by 0x1330868: Aws::Client::AWSAuthV4Signer::SignRequest(Aws::Http::HttpRequest&) const (AWSAuthSigner.cpp:120)
==18132==    by 0x133C72F: Aws::Client::AWSClient::AttemptOneRequest(std::string const&, Aws::AmazonWebServiceRequest const&, Aws::Http::HttpMethod) const (AWSClient.cpp:125)
==18132==    by 0x133C23D: Aws::Client::AWSClient::AttemptExhaustively(std::string const&, Aws::AmazonWebServiceRequest const&, Aws::Http::HttpMethod) const (AWSClient.cpp:76)
==18132==    by 0x133E78C: Aws::Client::AWSXMLClient::MakeRequest(std::string const&, Aws::AmazonWebServiceRequest const&, Aws::Http::HttpMethod) const (AWSClient.cpp:376)
==18132==    by 0x11AD4F8: Aws::S3::S3Client::PutObject(Aws::S3::Model::PutObjectRequest const&) const (S3Client.cpp:1659)
==18132==    by 0x12B62A3: Aws::Utils::Outcome<Aws::S3::Model::PutObjectResult, Aws::Client::AWSError<Aws::S3::S3Errors> > std::_Mem_fn<Aws::Utils::Outcome<Aws::S3::Model::PutObjectResult, Aws::Client::AWSError<Aws::S3::S3Errors> > (Aws::S3::S3Client::*)(Aws::S3::Model::PutObjectRequest const&) const>::operator()<Aws::S3::Model::PutObjectRequest, void>(Aws::S3::S3Client const*, Aws::S3::Model::PutObjectRequest&&) const (in /home/vagrant/bruce/linuxbuild/s3kv/s3kv)
==18132==    by 0x12B1E93: Aws::Utils::Outcome<Aws::S3::Model::PutObjectResult, Aws::Client::AWSError<Aws::S3::S3Errors> > std::_Bind_simple<std::_Mem_fn<Aws::Utils::Outcome<Aws::S3::Model::PutObjectResult, Aws::Client::AWSError<Aws::S3::S3Errors> > (Aws::S3::S3Client::*)(Aws::S3::Model::PutObjectRequest const&) const> (Aws::S3::S3Client const*, Aws::S3::Model::PutObjectRequest)>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) (functional:1700)
==18132==  Address 0xb73c080 is 0 bytes inside a block of size 32 alloc'd
==18132==    at 0x4C2BBA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18132==    by 0x135D269: Aws::Malloc(char const*, unsigned long) (AWSMemory.cpp:84)
==18132==    by 0x1334093: unsigned char* Aws::NewArray<unsigned char>(unsigned long, char const*) (AWSMemory.h:97)
==18132==    by 0x13338EA: Aws::Utils::Array<unsigned char>::Array(Aws::Utils::Array<unsigned char> const&) (Array.h:72)
==18132==    by 0x1332E31: Aws::Client::AWSAuthV4Signer::ComputePayloadHash(Aws::Http::HttpRequest&) const (AWSAuthSigner.cpp:339)
==18132==    by 0x1330868: Aws::Client::AWSAuthV4Signer::SignRequest(Aws::Http::HttpRequest&) const (AWSAuthSigner.cpp:120)
==18132==    by 0x133C72F: Aws::Client::AWSClient::AttemptOneRequest(std::string const&, Aws::AmazonWebServiceRequest const&, Aws::Http::HttpMethod) const (AWSClient.cpp:125)
==18132==    by 0x133C23D: Aws::Client::AWSClient::AttemptExhaustively(std::string const&, Aws::AmazonWebServiceRequest const&, Aws::Http::HttpMethod) const (AWSClient.cpp:76)
==18132==    by 0x133E78C: Aws::Client::AWSXMLClient::MakeRequest(std::string const&, Aws::AmazonWebServiceRequest const&, Aws::Http::HttpMethod) const (AWSClient.cpp:376)
==18132==    by 0x11AD4F8: Aws::S3::S3Client::PutObject(Aws::S3::Model::PutObjectRequest const&) const (S3Client.cpp:1659)
==18132==    by 0x12B62A3: Aws::Utils::Outcome<Aws::S3::Model::PutObjectResult, Aws::Client::AWSError<Aws::S3::S3Errors> > std::_Mem_fn<Aws::Utils::Outcome<Aws::S3::Model::PutObjectResult, Aws::Client::AWSError<Aws::S3::S3Errors> > (Aws::S3::S3Client::*)(Aws::S3::Model::PutObjectRequest const&) const>::operator()<Aws::S3::Model::PutObjectRequest, void>(Aws::S3::S3Client const*, Aws::S3::Model::PutObjectRequest&&) const (in /home/vagrant/bruce/linuxbuild/s3kv/s3kv)
==18132==    by 0x12B1E93: Aws::Utils::Outcome<Aws::S3::Model::PutObjectResult, Aws::Client::AWSError<Aws::S3::S3Errors> > std::_Bind_simple<std::_Mem_fn<Aws::Utils::Outcome<Aws::S3::Model::PutObjectResult, Aws::Client::AWSError<Aws::S3::S3Errors> > (Aws::S3::S3Client::*)(Aws::S3::Model::PutObjectRequest const&) const> (Aws::S3::S3Client const*, Aws::S3::Model::PutObjectRequest)>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) (functional:1700)

When I don't define AWS_CUSTOM_MEMORY_MANAGEMENT, then in AWSMemory.h the ArrayDeleter type gets defined as a deleter of an array type, and UniqueArrayPtr is going to use either that deleter or a deleter that calls DeleteArray, which ultimately does free.

However Array.h contains (in a couple of places):

 m_data.reset(Aws::NewArray<T>(m_size, ARRAY_ALLOCATION_TAG));

Where m_data is one of those UniqueArrayPtrs.

The data ALWAYS gets malloced, but when compiled without AWS_CUSTOM_MEMORY_MANAGEMENT, the data gets delete[]d instead of freed, which is an error.

Unable to build a simple S3 Client

While trying to build a simple S3 client similar to one presented at AWS Blog, I am getting the following error:

test.cxx:6:35: error: variable has incomplete type 'Aws::S3::Model::GetObjectRequest'
        Aws::S3::Model::GetObjectRequest getObjectRequest;
                                         ^
/home/satyenr/github/aws-sdk-cpp/aws-cpp-sdk-s3/include/aws/s3/S3Client.h:128:15: note: forward declaration of 'Aws::S3::Model::GetObjectRequest'
        class GetObjectRequest;
              ^

Here is the code snippet that is throwing the error:

    Aws::S3::S3Client s3Client;
    Aws::S3::Model::GetObjectRequest getObjectRequest;
    getObjectRequest.SetBucket("test-bucket");
    getObjectRequest.SetKey("test.txt");

Am I missing something here?

Additionally, some explanation of ALLOCATION_TAG would be really helpful.

Is there any documentation or examples that I can use to explore this further?

CMake Errors During Configuration

When configuring the project using a recent version of CMake (tested with 3.3.1 and 3.3.2), lots of errors are reported.

> cmake .. -G "Visual Studio 12 Win64"

CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_FLAGS_DEBUGOPT

This error is repeated maybe 30 times, then it alternates:

CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_EXE_LINKER_FLAGS_DEBUGOPT
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_FLAGS_DEBUGOPT

The project seems to build fine following this. The issue is that when using the project through CMake's ExternalProject_Add, where these errors are treated like compile errors and fail any dependent projects.

error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]

gcc is 5.1.

$ gcc --version
gcc (Ubuntu 5.1.0-0ubuntu11~14.04.1) 5.1.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

------------start make output --------------
[ 95%] Building CXX object aws-cpp-sdk-rds/CMakeFiles/aws-cpp-sdk-rds.dir/source/model/DescribeDBEngineVersionsRequest.cpp.o
[ 95%] Building CXX object aws-cpp-sdk-rds/CMakeFiles/aws-cpp-sdk-rds.dir/source/model/DBParameterGroupStatus.cpp.o
Linking CXX static library libaws-cpp-sdk-rds.a
[ 95%] Built target aws-cpp-sdk-rds
Scanning dependencies of target aws-cpp-sdk-access-management
[ 95%] Building CXX object aws-cpp-sdk-access-management/CMakeFiles/aws-cpp-sdk-access-management.dir/source/AccessManagementClient.cpp.o
Linking CXX static library libaws-cpp-sdk-access-management.a
[ 95%] Built target aws-cpp-sdk-access-management
Scanning dependencies of target aws-cpp-sdk-transfer
[ 95%] Building CXX object aws-cpp-sdk-transfer/CMakeFiles/aws-cpp-sdk-transfer.dir/source/transfer/UploadFileRequest.cpp.o
/home/john/third_party/aws-sdk-cpp/aws-cpp-sdk-transfer/source/transfer/UploadFileRequest.cpp: In lambda function:
/home/john/third_party/aws-sdk-cpp/aws-cpp-sdk-transfer/source/transfer/UploadFileRequest.cpp:927:263: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
(listObjectsOutcome.GetResult().GetContents().cbegin(), listObjectsOutcome.GetResult().GetContents().cend(), [&](const Aws::S3::Model::Object& thisObject) { return (thisObject.GetKey() == GetKeyName() && thisObject.GetSize() == GetFileS
^
At global scope:
cc1plus: error: unrecognized command line option ‘-Wno-unused-private-field’ [-Werror]
cc1plus: all warnings being treated as errors
make[2]: *** [aws-cpp-sdk-transfer/CMakeFiles/aws-cpp-sdk-transfer.dir/source/transfer/UploadFileRequest.cpp.o] Error 1
make[1]: *** [aws-cpp-sdk-transfer/CMakeFiles/aws-cpp-sdk-transfer.dir/all] Error 2
make: *** [all] Error 2

mapping needed between Region and BucketLocationConstraint

Ideally when doing GetBucketLocationRequest, we can get back a Region instead of another enum BucketLocationConstraint. But looking at these two enum's:

         enum class AWS_CORE_API Region
    {
        US_EAST_1,
        US_WEST_1,
        US_WEST_2,
        EU_WEST_1,
        EU_CENTRAL_1,
        AP_SOUTHEAST_1,
        AP_SOUTHEAST_2,
        AP_NORTHEAST_1,
        SA_EAST_1
    }


    enum class BucketLocationConstraint
      {
        NOT_SET,
        EU,
        eu_west_1,
        us_west_1,
        us_west_2,
        ap_southeast_1,
        ap_southeast_2,
        ap_northeast_1,
        sa_east_1,
        cn_north_1,
        eu_central_1
      };

There are some extra "location" in BucketLocationConstraint, i.e. NOT_SET, EU, and cn_north_1 which are not in Region. Can someone explain what are these in terms of Region?

Thanks,
Johnny

Segfault in release build

Hello,

I'm on Ubuntu 15.04 now. I have a segmentation fault for release build only. Debug build works fine. The library was compiled with STATIC_LINKING=1. Compiler - GCC 4.9.2.

My code:

bool MainWindow::credentialsProviderTest()
{
    Aws::Utils::Logging::InitializeAWSLogging(Aws::MakeShared<Aws::Utils::Logging::DefaultLogSystem>(ALLOCATION_TAG, Aws::Utils::Logging::LogLevel::Trace, "aws_sdk_"));

    // Create a client
    ClientConfiguration config;
    config.scheme = Scheme::HTTPS;
    config.connectTimeoutMs = 30000;
    config.requestTimeoutMs = 30000;

    auto cognitoIdentityClient = Aws::MakeShared<CognitoIdentityClient>(ALLOCATION_TAG, Aws::MakeShared<SimpleAWSCredentialsProvider>(ALLOCATION_TAG, "", ""), config);
    auto cognitoCachingAnonymousCredentialsProvider = Aws::MakeUnique<CognitoCachingAnonymousCredentialsProvider>(ALLOCATION_TAG, accountId, identityPoolId, cognitoIdentityClient);
    AWSCredentials credentials = cognitoCachingAnonymousCredentialsProvider->GetAWSCredentials();
    credentials = cognitoCachingAnonymousCredentialsProvider->GetAWSCredentials();

    Aws::Utils::Logging::ShutdownAWSLogging();
    return true;
}

Stack trace:
image

runCognitoIntegrationTests shows same problem:

image

log

Adding timestamps to metrics in PutMetricDataRequest results in a MalformedInput exception

When constructing a MetricDatum for CloudWatch, it seems that setting the timestamp on any datum in the request will result in errors upon attempting to submit the data to CloudWatch via the CloudWatchClient.PutMetricData(...) function.

It looks like the issue is that the output format generated by the CloudWatchClient does not match the specification here:

https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_PutMetricData.html

The code below generates the following request body:

Action=PutMetricData
&Namespace=MyMetricTest
&MetricData.member.1.MetricName=MyMetricName
&MetricData.member.1.Timestamp=1.44409e+012
&MetricData.member.1.Value=100
&Version=2010-08-01

But according to the specification, it looks like it should actually be generating this request body instead (the timestamp is required to be ISO 8601 formatted):

Action=PutMetricData
&Namespace=MyMetricTest
&MetricData.member.1.MetricName=MyMetricName
&MetricData.member.1.Timestamp=2015-10-05T16:40:00Z
&MetricData.member.1.Value=100
&Version=2010-08-01

Here is a code snippet to fully reproduce the issue:

#include <iostream>

#include "aws/core/auth/AWSCredentialsProvider.h"
#include "aws/monitoring/CloudWatchClient.h"
#include "aws/monitoring/model/PutMetricDataRequest.h"

using namespace Aws;
using namespace Aws::Auth;
using namespace Aws::CloudWatch;
using namespace Aws::CloudWatch::Model;
using namespace Aws::Http;
using namespace Aws::Client;
using namespace std::chrono;

long long GetMillisSinceEpoch(const std::chrono::time_point<std::chrono::system_clock>& timePoint)
{
    return duration_cast<std::chrono::milliseconds>(timePoint.time_since_epoch()).count();
}

long long GetMillisSinceEpoch()
{
    return GetMillisSinceEpoch(system_clock::now());
}

int main()
{
    /*
    This code results in the following output:

    ERROR: MalformedInput::Unable to parse ExceptionName: MalformedInput Message: timestamp must follow ISO8601
    Transmission failure
    */

    const char* accessKey = "MY_ACCESS_KEY";
    const char* secretKey = "MY_SECRET_KEY";

    AWSCredentials basicCreds(accessKey,secretKey);
    CloudWatchClient client = CloudWatchClient(basicCreds);
    PutMetricDataRequest request;
    request.SetNamespace("MyMetricTest");

    MetricDatum datum;
    datum.SetMetricName("MyMetricName");
    datum.SetValue(100.0);

    //This line is the problem!
    //(it's also not clear from the documentation what this "double" value actually represents)
    datum.SetTimestamp(static_cast<double>(GetMillisSinceEpoch())); 

    Aws::Vector<MetricDatum> metrics;
    metrics.push_back(datum);
    request.SetMetricData(metrics);

    char requestDump[4096];
    request.GetBody()->getline(requestDump, 4096);
    std::cout << "REQUEST = " << requestDump << std::endl;

    PutMetricDataOutcome outcome = client.PutMetricData(request);
    if (!outcome.IsSuccess())
    {
        std::cout << "ERROR: " << outcome.GetError().GetExceptionName() << "::" << outcome.GetError().GetMessage() << std::endl;
    }
    std::cout << "Transmission " << (outcome.IsSuccess() ? "success" : "failure") << std::endl;

    char dummy[256];
    std::cin.getline(dummy, 256);
}

Static linking for Windows not working?

This is to use the SDK with a native C++ 32-bit app, plain Win32 not MFC.

I tried both of these from a command prompt but Visual Studio shows the project as using a shared DLL:

E:\cmake-3.1.2-win32-x86\bin\cmake e:\vs12\aws-sdk-cpp-20151111 -G "Visual Studio 12" -STATIC=1

E:\cmake-3.1.2-win32-x86\bin\cmake e:\vs12\aws-sdk-cpp-20151111 -G "Visual Studio 12" -STATIC_LINKING=1

I tried changing the aws-cpp-sdk-core solution in VS2013 from shared DLL to static (/MT and /MTd) and get build errors:

2>E:\VS12\aws-sdk-cpp-20151111\aws-cpp-sdk-core\include\aws/core/utils/stream/ResponseStream.h(49): error C2220: warning treated as error - no 'object' file generated
2>E:\VS12\aws-sdk-cpp-20151111\aws-cpp-sdk-core\include\aws/core/utils/stream/ResponseStream.h(49): warning C4275: non dll-interface class 'std::ios_base' used as base for dll-interface class 'std::basic_ios<char,std::char_traits<char>>'
2>          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xiosbase(200) : see declaration of 'std::ios_base'

Do I need to do something else in Cmake to get a static project?

Documentation Issue: Aws::CloudWatch::Model::MetricDatum does not specify the units of the "timestamp" field

The "timestamp" field of a CloudWatch MetricDatum is used to tag a piece of data with the time at which it occurred. The AWS SDK CPP specifies this timestamp field as a double type, but does not indicate what the double actually represents.

Here is the current documentation from the MetricDatum.h file:

/*
     <p> The time stamp used for the metric. If not specified, the default value is set to the time the metric data was received. Amazon CloudWatch uses Coordinated Universal Time (UTC) when returning time stamps, which do not accommodate seasonal adjustments such as daylight savings time. For more information, see <a href="http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/cloudwatch_concepts.html#about_timestamp">Time stamps</a> in the <i>Amazon CloudWatch Developer Guide</i>. </p>
    */
    inline double GetTimestamp() const{ return m_timestamp; }

    /*
     <p> The time stamp used for the metric. If not specified, the default value is set to the time the metric data was received. Amazon CloudWatch uses Coordinated Universal Time (UTC) when returning time stamps, which do not accommodate seasonal adjustments such as daylight savings time. For more information, see <a href="http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/cloudwatch_concepts.html#about_timestamp">Time stamps</a> in the <i>Amazon CloudWatch Developer Guide</i>. </p>
    */
    inline void SetTimestamp(double value) { m_timestampHasBeenSet = true; m_timestamp = value; }

    /*
     <p> The time stamp used for the metric. If not specified, the default value is set to the time the metric data was received. Amazon CloudWatch uses Coordinated Universal Time (UTC) when returning time stamps, which do not accommodate seasonal adjustments such as daylight savings time. For more information, see <a href="http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/cloudwatch_concepts.html#about_timestamp">Time stamps</a> in the <i>Amazon CloudWatch Developer Guide</i>. </p>
    */
    inline MetricDatum& WithTimestamp(double value) { SetTimestamp(value); return *this;}

Should the double be interpreted as milliseconds since the 1970 epoch? Or seconds? Or something else entirely? CloudWatch itself expects an 8601 ISO formatted timestamp, so it is not entirely clear how this double field maps onto that timestamp.

Alternately, would it make sense to have a variant of the setters for timestamp that takes in a std::chrono::time_point (http://en.cppreference.com/w/cpp/chrono/time_point) object?

OS X: Linker errors when using static library - Undefined symbols for architecture x86_64

Hi

I am getting linker errors "Undefined symbols for architecture x86_64: " when trying to use the static libraries (build steps I used are noted below), in an XCode C++ command line project. I included the static libraries (.a) in Xcode Build-phases -> Link binary with libraries, and added their location paths to Build-Settings -> Library Search Paths. Full error report below.

Is there anything else I need to add (linker flags, settings, etc.) to resolve this error? Any help would be greatly appreciated.

PS: The code works on Windows Visual Studio, so I am wondering if there is anything I missed when trying it on OS X.

Error Report:

Undefined symbols for architecture x86_64:
  "Aws::Auth::CognitoCachingAnonymousCredentialsProvider::CognitoCachingAnonymousCredentialsProvider(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::shared_ptr<Aws::CognitoIdentity::CognitoIdentityClient> const&)", referenced from:
      std::__1::shared_ptr<Aws::Auth::CognitoCachingAnonymousCredentialsProvider> std::__1::shared_ptr<Aws::Auth::CognitoCachingAnonymousCredentialsProvider>::allocate_shared<std::__1::allocator<Aws::Auth::CognitoCachingAnonymousCredentialsProvider>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&>(std::__1::allocator<Aws::Auth::CognitoCachingAnonymousCredentialsProvider> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&&&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&&&) in aws-cpp-experiments.o
  "Aws::Utils::Json::JsonValue::WithObject(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Aws::Utils::Json::JsonValue const&)", referenced from:
      getCurrentUserAuthenticatedCredentials(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in aws-cpp-experiments.o
  "Aws::Utils::Json::JsonValue::WithString(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      getCurrentUserAuthenticatedCredentials(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in aws-cpp-experiments.o
  "Aws::Utils::Json::JsonValue::WithInt64(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, long long)", referenced from:
      getCurrentUserAuthenticatedCredentials(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in aws-cpp-experiments.o
  "Aws::Utils::Logging::DefaultLogSystem::DefaultLogSystem(Aws::Utils::Logging::LogLevel, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      std::__1::shared_ptr<Aws::Utils::Logging::DefaultLogSystem> std::__1::shared_ptr<Aws::Utils::Logging::DefaultLogSystem>::allocate_shared<std::__1::allocator<Aws::Utils::Logging::DefaultLogSystem>, Aws::Utils::Logging::LogLevel, char const (&) [9]>(std::__1::allocator<Aws::Utils::Logging::DefaultLogSystem> const&, Aws::Utils::Logging::LogLevel&&, char const (&&&) [9]) in aws-cpp-experiments.o
  "Aws::DynamoDB::Model::AttributeValue::SetS(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      Aws::DynamoDB::Model::AttributeValue::AttributeValue(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in aws-cpp-experiments.o
  "Aws::Utils::Json::JsonValue::GetInt64(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const", referenced from:
      isValidCredentials(Aws::Utils::Json::JsonValue) in aws-cpp-experiments.o
  "Aws::Utils::Json::JsonValue::GetString(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const", referenced from:
      isValidCredentials(Aws::Utils::Json::JsonValue) in aws-cpp-experiments.o
      getData1(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, Aws::Utils::Json::JsonValue) in aws-cpp-experiments.o
      getData2(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, Aws::Utils::Json::JsonValue) in aws-cpp-experiments.o
      isValidData(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, Aws::Utils::Json::JsonValue) in aws-cpp-experiments.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Build-Steps: I used the following to build the c++ sdk on Mac OS X (El Capitan).

  1. Added the following to CMakeLists.txt in the source folder (~/aws-sdk-cpp/CMakeLists.txt)
SET(STATIC_LINKING 1)
  1. Used following commands for creating XCode projects
cd "build-dir-path"
cmake -G Xcode "path-to-sdk-source-root"

Output of CMake:

-- TARGET_ARCH not specified; inferring host OS to be platform compilation target
-- Generating Mac OSX/IOS build config
-- Dynamic linking disabled
-- Custom memory management disabled
-- Http client: Curl
-- Encryption: CommonCrypto
-- The C compiler identification is AppleClang 7.0.0.7000176
-- The CXX compiler identification is AppleClang 7.0.0.7000176
-- Check for working C compiler using: Xcode
-- Check for working C compiler using: Xcode -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler using: Xcode
-- Check for working CXX compiler using: Xcode -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Install binary prefix: mac
-- Downloading client source from: 
-- Configuring done
-- Generating done
-- Build files have been written to: ~/build-dir
  1. From the created ~/build-dir/AWSNativeSDKAll.xcodeproj, I ran this to build the static libraries for all modules.

Setting a number of additional security settings

I've got an environment working properly with boto 2.38 where all the following settings are required (obviously I could have done the stuff in the ~/.boto file each time programmatically instead):

~/.boto file that contains...

ca_certificates_file = /path/to/cert.pem
endpoints_path = /path/to/endpoints.json

[ec2]
use-sigv4 = true

[s3]
use-sigv4 = true

Then when I connect, I need a security token, so I do...

boto.ec2.connect_to_region('regionName', security_token='*')

I'm trying to figure out how to do the equivalent with the C++ SDK. Tackling these one at a time...

  1. ca_certificates_file: I may be just searching on the wrong stuff, but the only reference to CA certificates I can find is in the rds module. Is this supported in the C++ SDK currently for sqs, ec2, and s3?
  2. endpoints_path: Looking at EC2Client::init(), I see that it calls EC2Endpoint::ForRegion() unless config.endpointOverride is populated. While the readme says not to alter the endpoint, it appears that just setting this string with what's in my endpoints.json for this service would do what I want (I do need to override the endpoint). Any reason this wouldn't work?
  3. use-sigv4: This sets Signature Version 4 signing. In AWSAuthSigner, I see an AWSAuthV4Signer class. The EC2Client constructors appear to be using this... will I get Signature Version 4 signing by default then or is there anything else I need to do to enable this?
  4. security_token: Rather than using the default credentials provider chain, it looks like I could construct AWSCredentials myself and pass this in right?
  5. Is there an equivalent of a ~/.boto file for the C++ SDK to set some of these things? If not, doing this programmatically is no big deal.

Thanks for the help!

HttpClient::MakeRequest(shared_ptr<HttpRequest>) Can return Null SharedPtr, but why?

It is possible (it happened to me anyways) for calls to the HttpClient to return a shared_ptr which is null with no apparent error being set in the library. Recreating the case may be a little difficult (it's deep in my code).

https://github.com/awslabs/aws-sdk-cpp/blob/master/aws-cpp-sdk-core/source/http/curl/CurlHttpClient.cpp#L153

    CURL* connectionHandle = m_curlHandleContainer.AcquireCurlHandle();

    if (connectionHandle)
    {
    /// snip
    }
    // No else clause, no error set!

Apparently the m_curlHandleContainer is returning a null handle. Why might that be and what information would be useful for you in debugging?

How to reach S3 bucket without specifying region

I can get object in S3 bucket when specifying region in ClientConfiguration:

ClientConfiguration config;
config.scheme = Scheme::HTTPS;
config.connectTimeoutMs = 30000;
config.requestTimeoutMs = 30000;
config.region = Aws::Region::US_WEST_2;
Aws::S3::S3Client Client(config);

And I'm wondering whether there is a way to get the same object in S3 bucket without specifying the region, similar to java sdk.

Thanks again for the great help!
Johnny

Not specifying a value for the m_uploadBufferCount in TransferClientConfiguration results in a memory-related crash

When using the TransferClient wrapper for the S3 Client, you must specify a TransferClientConfiguration object to pass into the constructor (there is not a TransferClient constructor that only accepts an S3 client).

The TransferClientConfiguration struct is defined in aws/transfer/TransferClient.h and looks like this:

struct AWS_TRANSFER_API TransferClientConfiguration
{
    public:

        uint32_t m_uploadBufferCount;
        std::shared_ptr< UploadBufferResourceManagerType > m_uploadBufferManager;
};

In the constructor of the TransferClient itself, it initializes the m_uploadBufferManager if it is not set, however, it does not initialize the m_uploadBufferCount:

TransferClient::TransferClient(const std::shared_ptr<Aws::S3::S3Client>& s3Client, const TransferClientConfiguration& config) :
    m_s3Client(s3Client),
    m_config(config),
    m_uploadBufferManager(config.m_uploadBufferManager)
{
    if(m_uploadBufferManager == nullptr)
    {
        m_uploadBufferManager = Aws::MakeShared< FairBoundedResourceManager< UploadBufferResourceType > >(ALLOCATION_TAG, ResourceFactoryFunction, config.m_uploadBufferCount, ResourceWaitPolicy::AT_LEAST_ONE_AVAILABLE);
    }
}

As a result, if the user does not initialize the m_uploadBufferCount themselves, it goes uninitialized and seems to cause problems later.

Here is a reproducible sample:

#include "aws/core/auth/AWSCredentialsProvider.h"
#include "aws/core/utils/memory/stl/AWSAllocator.h"
#include "aws/s3/S3Client.h"
#include "aws/transfer/TransferClient.h"

using namespace Aws::Auth;
using namespace Aws::S3;
using namespace Aws::Transfer;

int main()
{
    const char* ALLOCATION_TAG = "CustomerFeedbackManager";

    auto s3Client = Aws::MakeShared<S3Client>(ALLOCATION_TAG, AWSCredentials("access_key_id", "secret_key"));

    TransferClientConfiguration transferConfig;

    //If this line is commented out, the application will generally crash with a memory-related error
    //transferConfig.m_uploadBufferCount = 1;

    auto s3TransferClient = Aws::MakeShared<TransferClient>(ALLOCATION_TAG, s3Client, transferConfig);
}

In Visual Studio 2013 on Windows, this sample program generates this error:

Debug Assertion Failed

Program: C:\WINDOWS\system32\MSVCP120D.dll
File: C:\Program Files (x86)\Microsoft Visual Studio\12.0\VC\include\xmemory
Line: 439

Expression: invalid null pointer

For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts.

FEATURE REQUEST: Add support for ObjectMetadata to the TransferClient

The TransferClient is really useful for uploading files to S3, but unfortunately it currently only provides one function for doing file uploads:

std::shared_ptr<UploadFileRequest> UploadFile(const Aws::String& fileName, const Aws::String& bucketName, const Aws::String& keyName, const Aws::String& contentType, bool createBucket = false, bool doConsistencyChecks = false);

If you choose to use the S3Client directly, however, there are more options for specifying different values using things such as the PutObjectRequest. For instance, the PutObjectRequest allows the user to specify things like the S3 storage class, whether to use Server-Side Encryption or just general object metadata. It would be great if some of these features were available via the TransferClient as well.

For now, the workaround when these features are required is to just use the S3Client directly and not the TransferClient.

AWS_CUSTOM_MEMORY_MANAGEMENT causes crash on Ubuntu 14.04

I built the aws-sdk-cpp using the default options on Ubuntu 14.04 and the vanilla S3Client constructor was always crashing on me with the following stack trace. I rebuilt with AWS_CUSTOM_MEMORY_MANAGEMENT disabled and it worked fine.
#0 0x00007ffff5e10cc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1 0x00007ffff5e140d8 in __GI_abort () at abort.c:89
#2 0x00007ffff5e4d394 in __libc_message (do_abort=do_abort@entry=1, fmt=fmt@entry=0x7ffff5f5bb28 "*** Error in `%s': %s: 0x%s **\n") at ../sysdeps/posix/libc_fatal.c:175
#3 0x00007ffff5e5966e in malloc_printerr (ptr=, str=0x7ffff5f57c19 "free(): invalid pointer", action=1) at malloc.c:4996
#4 _int_free (av=, p=, have_lock=0) at malloc.c:3840
#5 0x00007ffff646f32f in std::basic_string<char, std::char_traits, std::allocator >::~basic_string() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6 0x00000000004095ec in Aws::Client::ClientConfiguration::~ClientConfiguration() ()
#7 0x00007ffff7970b8d in Aws::Internal::EC2MetadataClient::EC2MetadataClient (this=0x612398, endpoint=0x7ffff7994111 "http://169.254.169.254", httpClientFactory=...) at /home/vagrant/aws-sdk-cpp/aws-cpp-sdk-core/source/internal/EC2MetadataClient.cpp:47
#8 0x00007ffff7964bc2 in __gnu_cxx::new_allocatorAws::Internal::EC2MetadataClient::constructAws::Internal::EC2MetadataClient< > (this=0x7fffffffda7f, __p=0x612398) at /usr/include/c++/4.8/ext/new_allocator.h:120
#9 0x00007ffff7964a87 in std::allocator_traitsAws::Allocator<Aws::Internal::EC2MetadataClient >::_S_constructAws::Internal::EC2MetadataClient< >(Aws::AllocatorAws::Internal::EC2MetadataClient&, std::allocator_traitsAws::Allocator<Aws::Internal::EC2MetadataClient >::__construct_helper
, (Aws::Internal::EC2MetadataClient<>&&)...) (__a=..., __p=0x612398)

at /usr/include/c++/4.8/bits/alloc_traits.h:254

#10 0x00007ffff7964989 in std::allocator_traitsAws::Allocator<Aws::Internal::EC2MetadataClient >::constructAws::Internal::EC2MetadataClient< >(Aws::AllocatorAws::Internal::EC2MetadataClient&, Aws::Internal::EC2MetadataClient<>, (Aws::Internal::EC2MetadataClient<>&&)...) (__a=..., __p=0x612398) at /usr/include/c++/4.8/bits/alloc_traits.h:393
#11 0x00007ffff7964791 in std::_Sp_counted_ptr_inplace<Aws::Internal::EC2MetadataClient, Aws::AllocatorAws::Internal::EC2MetadataClient, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<>(Aws::AllocatorAws::Internal::EC2MetadataClient) (this=0x612380, __a=...) at /usr/include/c++/4.8/bits/shared_ptr_base.h:399
#12 0x00007ffff796447e in __gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<Aws::Internal::EC2MetadataClient, Aws::AllocatorAws::Internal::EC2MetadataClient, (__gnu_cxx::_Lock_policy)2> >::construct<std::_Sp_counted_ptr_inplace<Aws::Internal::EC2MetadataClient, Aws::AllocatorAws::Internal::EC2MetadataClient, (__gnu_cxx::_Lock_policy)2>Aws::Allocator<Aws::Internal::EC2MetadataClient const> > (this=0x7fffffffdb27, __p=0x612380) at /usr/include/c++/4.8/ext/new_allocator.h:120
#13 0x00007ffff7964281 in std::allocator_traits<Aws::Allocator<std::_Sp_counted_ptr_inplace<Aws::Internal::EC2MetadataClient, Aws::AllocatorAws::Internal::EC2MetadataClient, (__gnu_cxx::_Lock_policy)2> > >::_S_construct<std::_Sp_counted_ptr_inplace<Aws::Internal::EC2MetadataClient, Aws::AllocatorAws::Internal::EC2MetadataClient, (__gnu_cxx::_Lock_policy)2>Aws::Allocator<Aws::Internal::EC2MetadataClient const> >(Aws::Allocator<std::_Sp_counted_ptr_inplace<Aws::Internal::EC2MetadataClient, Aws::AllocatorAws::Internal::EC2MetadataClient, (__gnu_cxx::_Lock_policy)2> >&, std::allocator_traits<Aws::Allocator<std::_Sp_counted_ptr_inplace<Aws::Internal::EC2MetadataClient, Aws::AllocatorAws::Internal::EC2MetadataClient, (__gnu_cxx::_Lock_policy)2> > >::__construct_helper
, (std::_Sp_counted_ptr_inplace<Aws::Internal::EC2MetadataClient, Aws::AllocatorAws::Internal::EC2MetadataClient, (__gnu_cxx::_Lock_policy)2>Aws::Allocator<Aws::Internal::EC2MetadataClient const>&&)...) (__a=..., __p=0x612380) at /usr/include/c++/4.8/bits/alloc_traits.h:254
#14 0x00007ffff7963f84 in std::allocator_traits<Aws::Allocator<std::_Sp_counted_ptr_inplace<Aws::Internal::EC2MetadataClient, Aws::AllocatorAws::Internal::EC2MetadataClient, (__gnu_cxx::_Lock_policy)2> > >::construct<std::_Sp_counted_ptr_inplace<Aws::Internal::EC2MetadataClient, Aws::AllocatorAws::Internal::EC2MetadataClient, (__gnu_cxx::_Lock_policy)2>Aws::Allocator<Aws::Internal::EC2MetadataClient const> >(Aws::Allocator<std::_Sp_counted_ptr_inplace<Aws::Internal::EC2MetadataClient, Aws::AllocatorAws::Internal::EC2MetadataClient, (__gnu_cxx::_Lock_policy)2> >&, std::_Sp_counted_ptr_inplace<Aws::Internal::EC2MetadataClient, Aws::AllocatorAws::Internal::EC2MetadataClient, (__gnu_cxx::_Lock_policy)2>Aws::Allocator<Aws::Internal::EC2MetadataClient const>, (std::_Sp_counted_ptr_inplace<Aws::Internal::EC2MetadataClient, Aws::AllocatorAws::Internal::EC2MetadataClient, (__gnu_cxx::_Lock_policy)2>Aws::Allocator<Aws::Internal::EC2MetadataClient const>&&)...) (__a=..., __p=0x612380) at /usr/include/c++/4.8/bits/alloc_traits.h:393
#15 0x00007ffff7963c79 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<Aws::Internal::EC2MetadataClient, Aws::AllocatorAws::Internal::EC2MetadataClient>(std::_Sp_make_shared_tag, Aws::Internal::EC2MetadataClient
, Aws::AllocatorAws::Internal::EC2MetadataClient const&) (this=0x7fffffffdc48, __a=...)

at /usr/include/c++/4.8/bits/shared_ptr_base.h:502

#16 0x00007ffff796392e in std::__shared_ptr<Aws::Internal::EC2MetadataClient, (__gnu_cxx::_Lock_policy)2>::__shared_ptrAws::AllocatorAws::Internal::EC2MetadataClient(std::_Sp_make_shared_tag, Aws::AllocatorAws::Internal::EC2MetadataClient const&) (this=0x7fffffffdc40, __tag=..., __a=...) at /usr/include/c++/4.8/bits/shared_ptr_base.h:957
#17 0x00007ffff79635d4 in std::shared_ptrAws::Internal::EC2MetadataClient::shared_ptrAws::AllocatorAws::Internal::EC2MetadataClient(std::_Sp_make_shared_tag, Aws::AllocatorAws::Internal::EC2MetadataClient const&) (this=0x7fffffffdc40, __tag=..., __a=...) at /usr/include/c++/4.8/bits/shared_ptr.h:316
#18 0x00007ffff7962db4 in std::allocate_shared<Aws::Internal::EC2MetadataClient, Aws::AllocatorAws::Internal::EC2MetadataClient>(Aws::AllocatorAws::Internal::EC2MetadataClient const&) (__a=...) at /usr/include/c++/4.8/bits/shared_ptr.h:598
#19 0x00007ffff79625ed in Aws::MakeSharedAws::Internal::EC2MetadataClient (allocationTag=0x7ffff7993e00 "InstanceProfileCredentialsProvider") at /home/vagrant/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/memory/stl/AWSAllocator.h:97
#20 0x00007ffff796163d in Aws::Auth::InstanceProfileCredentialsProvider::InstanceProfileCredentialsProvider (this=0x6122b8, refreshRateMs=900000) at /home/vagrant/aws-sdk-cpp/aws-cpp-sdk-core/source/auth/AWSCredentialsProvider.cpp:305
#21 0x00007ffff795f65c in __gnu_cxx::new_allocatorAws::Auth::InstanceProfileCredentialsProvider::constructAws::Auth::InstanceProfileCredentialsProvider< > (this=0x7fffffffdd1f, __p=0x6122b8) at /usr/include/c++/4.8/ext/new_allocator.h:120
#22 0x00007ffff795f5b3 in std::allocator_traitsAws::Allocator<Aws::Auth::InstanceProfileCredentialsProvider >::_S_constructAws::Auth::InstanceProfileCredentialsProvider< >(Aws::AllocatorAws::Auth::InstanceProfileCredentialsProvider&, std::allocator_traitsAws::Allocator<Aws::Auth::InstanceProfileCredentialsProvider >::__construct_helper*, (Aws::Auth::InstanceProfileCredentialsProvider<>&&)...) (__a=..., __p=0x6122b8) at /usr/include/c++/4.8/bits/alloc_traits.h:254
#23 0x00007ffff795f517 in std::allocator_traitsAws::Allocator<Aws::Auth::InstanceProfileCredentialsProvider >::constructAws::Auth::InstanceProfileCredentialsProvider< >(Aws::AllocatorAws::Auth::InstanceProfileCredentialsProvider&, Aws::Auth::InstanceProfileCredentialsProvider<>*, (Aws::Auth::InstanceProfileCredentialsProvider<>&&)...) (__a=...,

__p=0x6122b8) at /usr/include/c++/4.8/bits/alloc_traits.h:393

#24 0x00007ffff795f3a3 in std::_Sp_counted_ptr_inplace<Aws::Auth::InstanceProfileCredentialsProvider, Aws::AllocatorAws::Auth::InstanceProfileCredentialsProvider, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<>(Aws::AllocatorAws::Auth::InstanceProfileCredentialsProvider) (this=0x6122a0, __a=...) at /usr/include/c++/4.8/bits/shared_ptr_base.h:399
#25 0x00007ffff795f0d2 in __gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<Aws::Auth::InstanceProfileCredentialsProvider, Aws::AllocatorAws::Auth::InstanceProfileCredentialsProvider, (__gnu_cxx::_Lock_policy)2> >::construct<std::_Sp_counted_ptr_inplace<Aws::Auth::InstanceProfileCredentialsProvider, Aws::AllocatorAws::Auth::InstanceProfileCredentialsProvider, (__gnu_cxx::_Lock_policy)2>Aws::Allocator<Aws::Auth::InstanceProfileCredentialsProvider const> > (this=0x7fffffffddc7, __p=0x6122a0) at /usr/include/c++/4.8/ext/new_allocator.h:120
#26 0x00007ffff795ef12 in std::allocator_traits<Aws::Allocator<std::_Sp_counted_ptr_inplace<Aws::Auth::InstanceProfileCredentialsProvider, Aws::AllocatorAws::Auth::InstanceProfileCredentialsProvider, (__gnu_cxx::_Lock_policy)2> > >::_S_construct<std::_Sp_counted_ptr_inplace<Aws::Auth::InstanceProfileCredentialsProvider, Aws::AllocatorAws::Auth::InstanceProfileCredentialsProvider, (__gnu_cxx::_Lock_policy)2>Aws::Allocator<Aws::Auth::InstanceProfileCredentialsProvider const> >(Aws::Allocator<std::_Sp_counted_ptr_inplace<Aws::Auth::InstanceProfileCredentialsProvider, Aws::AllocatorAws::Auth::InstanceProfileCredentialsProvider, (__gnu_cxx::_Lock_policy)2> >&, std::allocator_traits<Aws::Allocator<std::_Sp_counted_ptr_inplace<Aws::Auth::InstanceProfileCredentialsProvider, Aws::AllocatorAws::Auth::InstanceProfileCredentialsProvider, (__gnu_cxx::_Lock_policy)2> > >::__construct_helper*, (std::_Sp_counted_ptr_inplace<Aws::Auth::InstanceProfileCredentialsProvider, Aws::AllocatorAws::Auth::InstanceProfileCredentialsProvider, (__gnu_cxx::_Lock_policy)2>Aws::Allocator<Aws::Auth::InstanceProfileCredentialsProvider const>&&)...) (__a=..., __p=0x6122a0) at /usr/include/c++/4.8/bits/alloc_traits.h:254
#27 0x00007ffff795ec32 in std::allocator_traits<Aws::Allocator<std::_Sp_counted_ptr_inplace<Aws::Auth::InstanceProfileCredentialsProvider, Aws::AllocatorAws::Auth::InstanceProfileCredentialsProvider, (__gnu_cxx::_Lock_policy)2> > >::construct<std::_Sp_counted_ptr_inplace<Aws::Auth::InstanceProfileCredentialsProvider, Aws::AllocatorAws::Auth::InstanceProfileCredentialsProvider, (__gnu_cxx::_Lock_policy)2>Aws::Allocator<Aws::Auth::InstanceProfileCredentialsProvider const> >(Aws::Allocator<std::_Sp_counted_ptr_inplace<Aws::Auth::InstanceProfileCredentialsProvider, Aws::AllocatorAws::Auth::InstanceProfileCredentialsProvider, (__gnu_cxx::_Lock_policy)2> >&, std::_Sp_counted_ptr_inplace<Aws::Auth::InstanceProfileCredentialsProvider, Aws::AllocatorAws::Auth::InstanceProfileCredentialsProvider, (__gnu_cxx::_Lock_policy)2>Aws::Allocator<Aws::Auth::InstanceProfileCredentialsProvider const>, (std::_Sp_counted_ptr_inplace<Aws::Auth::InstanceProfileCredentialsProvider, Aws::AllocatorAws::Auth::InstanceProfileCredentialsProvider, (__gnu_cxx::_Lock_policy)2>Aws::Allocator<Aws::Auth::InstanceProfileCredentialsProvider const>&&)...) (__a=..., __p=0x6122a0) at /usr/include/c++/4.8/bits/alloc_traits.h:393
#28 0x00007ffff795e943 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<Aws::Auth::InstanceProfileCredentialsProvider, Aws::AllocatorAws::Auth::InstanceProfileCredentialsProvider>(std::_Sp_make_shared_tag, Aws::Auth::InstanceProfileCredentialsProvider
, Aws::AllocatorAws::Auth::InstanceProfileCredentialsProvider const&) (

this=0x7fffffffdee8, __a=...) at /usr/include/c++/4.8/bits/shared_ptr_base.h:502

#29 0x00007ffff795e600 in std::__shared_ptr<Aws::Auth::InstanceProfileCredentialsProvider, (__gnu_cxx::_Lock_policy)2>::__shared_ptrAws::AllocatorAws::Auth::InstanceProfileCredentialsProvider(std::_Sp_make_shared_tag, Aws::AllocatorAws::Auth::InstanceProfileCredentialsProvider const&) (this=0x7fffffffdee0, __tag=..., __a=...)

at /usr/include/c++/4.8/bits/shared_ptr_base.h:957

#30 0x00007ffff795e2a0 in std::shared_ptrAws::Auth::InstanceProfileCredentialsProvider::shared_ptrAws::AllocatorAws::Auth::InstanceProfileCredentialsProvider(std::_Sp_make_shared_tag, Aws::AllocatorAws::Auth::InstanceProfileCredentialsProvider const&) (this=0x7fffffffdee0, __tag=..., __a=...) at /usr/include/c++/4.8/bits/shared_ptr.h:316
#31 0x00007ffff795dec4 in std::allocate_shared<Aws::Auth::InstanceProfileCredentialsProvider, Aws::AllocatorAws::Auth::InstanceProfileCredentialsProvider>(Aws::AllocatorAws::Auth::InstanceProfileCredentialsProvider const&) (__a=...) at /usr/include/c++/4.8/bits/shared_ptr.h:598
#32 0x00007ffff795da03 in Aws::MakeSharedAws::Auth::InstanceProfileCredentialsProvider (allocationTag=0x7ffff7993838 "DefaultAWSCredentialsProviderChain") at /home/vagrant/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/memory/stl/AWSAllocator.h:97
#33 0x00007ffff795d32a in Aws::Auth::DefaultAWSCredentialsProviderChain::DefaultAWSCredentialsProviderChain (this=0x612108) at /home/vagrant/aws-sdk-cpp/aws-cpp-sdk-core/source/auth/AWSCredentialsProviderChain.cpp:42
#34 0x00007ffff7403d30 in __gnu_cxx::new_allocatorAws::Auth::DefaultAWSCredentialsProviderChain::constructAws::Auth::DefaultAWSCredentialsProviderChain< > (this=0x7fffffffdfbf, __p=0x612108) at /usr/include/c++/4.8/ext/new_allocator.h:120
#35 0x00007ffff73fdfe1 in std::allocator_traitsAws::Allocator<Aws::Auth::DefaultAWSCredentialsProviderChain >::_S_constructAws::Auth::DefaultAWSCredentialsProviderChain< >(Aws::AllocatorAws::Auth::DefaultAWSCredentialsProviderChain&, std::allocator_traitsAws::Allocator<Aws::Auth::DefaultAWSCredentialsProviderChain >::__construct_helper*, (Aws::Auth::DefaultAWSCredentialsProviderChain<>&&)...) (__a=..., __p=0x612108) at /usr/include/c++/4.8/bits/alloc_traits.h:254
#36 0x00007ffff73f9e47 in std::allocator_traitsAws::Allocator<Aws::Auth::DefaultAWSCredentialsProviderChain >::constructAws::Auth::DefaultAWSCredentialsProviderChain< >(Aws::AllocatorAws::Auth::DefaultAWSCredentialsProviderChain&, Aws::Auth::DefaultAWSCredentialsProviderChain<>*, (Aws::Auth::DefaultAWSCredentialsProviderChain<>&&)...) (__a=...,

__p=0x612108) at /usr/include/c++/4.8/bits/alloc_traits.h:393

#37 0x00007ffff73f42c7 in std::_Sp_counted_ptr_inplace<Aws::Auth::DefaultAWSCredentialsProviderChain, Aws::AllocatorAws::Auth::DefaultAWSCredentialsProviderChain, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<>(Aws::AllocatorAws::Auth::DefaultAWSCredentialsProviderChain) (this=0x6120f0, __a=...) at /usr/include/c++/4.8/bits/shared_ptr_base.h:399
#38 0x00007ffff73ee19a in __gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<Aws::Auth::DefaultAWSCredentialsProviderChain, Aws::AllocatorAws::Auth::DefaultAWSCredentialsProviderChain, (__gnu_cxx::_Lock_policy)2> >::construct<std::_Sp_counted_ptr_inplace<Aws::Auth::DefaultAWSCredentialsProviderChain, Aws::AllocatorAws::Auth::DefaultAWSCredentialsProviderChain, (__gnu_cxx::_Lock_policy)2>Aws::Allocator<Aws::Auth::DefaultAWSCredentialsProviderChain const> > (this=0x7fffffffe067, __p=0x6120f0) at /usr/include/c++/4.8/ext/new_allocator.h:120
#39 0x00007ffff73e8bd7 in std::allocator_traits<Aws::Allocator<std::_Sp_counted_ptr_inplace<Aws::Auth::DefaultAWSCredentialsProviderChain, Aws::AllocatorAws::Auth::DefaultAWSCredentialsProviderChain, (__gnu_cxx::_Lock_policy)2> > >::_S_construct<std::_Sp_counted_ptr_inplace<Aws::Auth::DefaultAWSCredentialsProviderChain, Aws::AllocatorAws::Auth::DefaultAWSCredentialsProviderChain, (__gnu_cxx::_Lock_policy)2>Aws::Allocator<Aws::Auth::DefaultAWSCredentialsProviderChain const> >(Aws::Allocator<std::_Sp_counted_ptr_inplace<Aws::Auth::DefaultAWSCredentialsProviderChain, Aws::AllocatorAws::Auth::DefaultAWSCredentialsProviderChain, (__gnu_cxx::_Lock_policy)2> >&, std::allocator_traits<Aws::Allocator<std::_Sp_counted_ptr_inplace<Aws::Auth::DefaultAWSCredentialsProviderChain, Aws::AllocatorAws::Auth::DefaultAWSCredentialsProviderChain, (__gnu_cxx::_Lock_policy)2> > >::__construct_helper*, (std::_Sp_counted_ptr_inplace<Aws::Auth::DefaultAWSCredentialsProviderChain, Aws::AllocatorAws::Auth::DefaultAWSCredentialsProviderChain, (__gnu_cxx::_Lock_policy)2>Aws::Allocator<Aws::Auth::DefaultAWSCredentialsProviderChain const>&&)...) (__a=..., __p=0x6120f0) at /usr/include/c++/4.8/bits/alloc_traits.h:254
#40 0x00007ffff73df77c in std::allocator_traits<Aws::Allocator<std::_Sp_counted_ptr_inplace<Aws::Auth::DefaultAWSCredentialsProviderChain, Aws::AllocatorAws::Auth::DefaultAWSCredentialsProviderChain, (__gnu_cxx::_Lock_policy)2> > >::construct<std::_Sp_counted_ptr_inplace<Aws::Auth::DefaultAWSCredentialsProviderChain, Aws::AllocatorAws::Auth::DefaultAWSCredentialsProviderChain, (__gnu_cxx::_Lock_policy)2>Aws::Allocator<Aws::Auth::DefaultAWSCredentialsProviderChain const> >(Aws::Allocator<std::_Sp_counted_ptr_inplace<Aws::Auth::DefaultAWSCredentialsProviderChain, Aws::AllocatorAws::Auth::DefaultAWSCredentialsProviderChain, (__gnu_cxx::_Lock_policy)2> >&, std::_Sp_counted_ptr_inplace<Aws::Auth::DefaultAWSCredentialsProviderChain, Aws::AllocatorAws::Auth::DefaultAWSCredentialsProviderChain, (__gnu_cxx::_Lock_policy)2>Aws::Allocator<Aws::Auth::DefaultAWSCredentialsProviderChain const>, (std::_Sp_counted_ptr_inplace<Aws::Auth::DefaultAWSCredentialsProviderChain, Aws::AllocatorAws::Auth::DefaultAWSCredentialsProviderChain, (__gnu_cxx::_Lock_policy)2>Aws::Allocator<Aws::Auth::DefaultAWSCredentialsProviderChain const>&&)...) (__a=..., __p=0x6120f0) at /usr/include/c++/4.8/bits/alloc_traits.h:393
#41 0x00007ffff73d483d in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<Aws::Auth::DefaultAWSCredentialsProviderChain, Aws::AllocatorAws::Auth::DefaultAWSCredentialsProviderChain>(std::_Sp_make_shared_tag, Aws::Auth::DefaultAWSCredentialsProviderChain
, Aws::AllocatorAws::Auth::DefaultAWSCredentialsProviderChain const&) (

this=0x7fffffffe1b8, __a=...) at /usr/include/c++/4.8/bits/shared_ptr_base.h:502

#42 0x00007ffff73be9b4 in std::__shared_ptr<Aws::Auth::DefaultAWSCredentialsProviderChain, (__gnu_cxx::_Lock_policy)2>::__shared_ptrAws::AllocatorAws::Auth::DefaultAWSCredentialsProviderChain(std::_Sp_make_shared_tag, Aws::AllocatorAws::Auth::DefaultAWSCredentialsProviderChain const&) (this=0x7fffffffe1b0, __tag=..., __a=...)

at /usr/include/c++/4.8/bits/shared_ptr_base.h:957

#43 0x00007ffff739df72 in std::shared_ptrAws::Auth::DefaultAWSCredentialsProviderChain::shared_ptrAws::AllocatorAws::Auth::DefaultAWSCredentialsProviderChain(std::_Sp_make_shared_tag, Aws::AllocatorAws::Auth::DefaultAWSCredentialsProviderChain const&) (this=0x7fffffffe1b0, __tag=..., __a=...) at /usr/include/c++/4.8/bits/shared_ptr.h:316
#44 0x00007ffff73796f8 in std::allocate_shared<Aws::Auth::DefaultAWSCredentialsProviderChain, Aws::AllocatorAws::Auth::DefaultAWSCredentialsProviderChain>(Aws::AllocatorAws::Auth::DefaultAWSCredentialsProviderChain const&) (__a=...) at /usr/include/c++/4.8/bits/shared_ptr.h:598
#45 0x00007ffff735d5fa in Aws::MakeSharedAws::Auth::DefaultAWSCredentialsProviderChain (allocationTag=0x7ffff74cc709 "S3Client") at /home/vagrant/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/memory/stl/AWSAllocator.h:97
#46 0x00007ffff734f7e4 in Aws::S3::S3Client::S3Client (this=0x7fffffffe240, clientConfiguration=...) at /home/vagrant/aws-sdk-cpp/aws-cpp-sdk-s3/source/S3Client.cpp:97

[Question] Thread Safety

Hi, I am unsure where else may be a more appropriate place to ask this question. What assumptions/expectations should I have regarding thread safety. And, are methods comment decorated with such specifications anywhere?

Particularly I am concerned with the various Factory classes.

Thanks.

Working code sample for S3? Document how to construct S3Client with auth and config?

The blog post sample does not set a configuration or authentication provider for the S3 client. The headers do not document how to construct one. The test harness offers clues but not an example that I can copy.

According to the headers, I can use this:

S3Client(const Auth::AWSCredentials& credentials, const Client::ClientConfiguration& clientConfiguration = Client::ClientConfiguration());

But that requires me to successfully create those objects. I poked around the core headers and found this:

AWSCredentials(const Aws::String& accessKeyId, const Aws::String& secretKey, const Aws::String& sessionToken = ""

But the code below will not compile -- "incomplete type not permitted"

const char* secret_id = "foo";
const char* secret_key = "bar";
Aws::Auth::AWSCredentials creds(secret_id, secret_key);

I'm guessing I need to do something with < > and AWS::foo but guessing that without documentation or samples is going to be difficult.

DefaultLogSystem constructor makes it hard to log to stderr

For my testing program, I would like to log to stderr. The signature of DefaultLogSystem makes that quite hard though.

I would like to just plug in a pointer/reference to std::cerr, but according to the constructor it must be wrapped inside a shared_ptr.

For obvious reasons, I can't put std::cerr into a smart pointer or my program will segfault.

I tried making a wrapper object using Boost.Iostreams but for some reason that has a static_assert saying that I'm not allowed to wrap any of the built-in streams.

It would be good if there was a constructor where I could just pass in a naked pointer (or you supply an object that I can construct and pass that wraps another std::ostream).

Crash when accessing S3 bucket

I'm trying to use the AWS SDK CPP S3 API from EC2 instance(Centos7) to get file from S3 bucket, but the program will always end up crashing. Please let me know if I do anything wrong with the following program:

string retrieve(const string& bucketName)
{
S3Client Client;

Aws::StringStream ss;
GetObjectRequest getObjectRequest;

Aws::String bucket(bucketName);
getObjectRequest.SetBucket(bucket);
getObjectRequest.SetKey("something.txt");

GetObjectOutcome getObjectOutcome = Client.GetObject(getObjectRequest);
ss.str("");
ss << getObjectOutcome.GetResult().GetBody().rdbuf();
return ss.str();
}

int main ( int argc, char** argv )
{
if ( argc < 2 )
{
cout<<"usage: "<< argv[0] <<" " << endl;
return 1;
}

string bucketName(argv[1]);
string txt(retrieve(bucketName));
cout << txt << endl;

return 0;
}

*** Error in `./retrieve': free(): invalid pointer: 0x00007f45c9921320 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x7d1fd)[0x7f45c869d1fd]
./retrieve(_ZN3Aws6Client19ClientConfigurationD2Ev+0x333)[0x402dd3]
libaws-cpp-sdk-core.so(_ZN3Aws8Internal17EC2MetadataClientC1EPKcSt10shared_ptrIKNS_4Http17HttpClientFactoryEE+0x33a)[0x7f45c92619ea]
libaws-cpp-sdk-core.so(ZNSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EEC2IN3Aws8Internal17EC2MetadataClientENS4_9AllocatorIS6_EEJEEESt19_Sp_make_shared_tagPT_RKT0_DpOT1+0x6b)[0x7f45c925a0fb]
libaws-cpp-sdk-core.so(_ZN3Aws4Auth34InstanceProfileCredentialsProviderC1El+0x9d)[0x7f45c9258fcd]
libaws-cpp-sdk-core.so(_ZN3Aws4Auth34DefaultAWSCredentialsProviderChainC1Ev+0x332)[0x7f45c925ac12]
libaws-cpp-sdk-s3.so(_ZN3Aws2S38S3ClientC1ERKNS_6Client19ClientConfigurationE+0xb8)[0x7f45c95e9cd8]
./retrieve[0x401f12]
./retrieve[0x402839]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x7f45c8641af5]
./retrieve[0x401e19]
======= Memory map: ========
00400000-00405000 r-xp 00000000 ca:01 3077097 /home/centos/patches/retrieve
00604000-00605000 r--p 00004000 ca:01 3077097 /home/centos/patches/retrieve
00605000-00606000 rw-p 00005000 ca:01 3077097 /home/centos/patches/retrieve
00bda000-00bfb000 rw-p 00000000 00:00 0 [heap]
7f45c3fda000-7f45c3fdc000 r-xp 00000000 ca:01 1576 /usr/lib64/libfreebl3.so
7f45c3fdc000-7f45c41db000 ---p 00002000 ca:01 1576 /usr/lib64/libfreebl3.so
7f45c41db000-7f45c41dc000 r--p 00001000 ca:01 1576 /usr/lib64/libfreebl3.so
7f45c41dc000-7f45c41dd000 rw-p 00002000 ca:01 1576 /usr/lib64/libfreebl3.so
7f45c41dd000-7f45c4201000 r-xp 00000000 ca:01 15499 /usr/lib64/liblzma.so.5.0.99
7f45c4201000-7f45c4400000 ---p 00024000 ca:01 15499 /usr/lib64/liblzma.so.5.0.99
7f45c4400000-7f45c4401000 r--p 00023000 ca:01 15499 /usr/lib64/liblzma.so.5.0.99
7f45c4401000-7f45c4402000 rw-p 00024000 ca:01 15499 /usr/lib64/liblzma.so.5.0.99
7f45c4402000-7f45c4461000 r-xp 00000000 ca:01 125123 /usr/lib64/libpcre.so.1.2.0
7f45c4461000-7f45c4661000 ---p 0005f000 ca:01 125123 /usr/lib64/libpcre.so.1.2.0
7f45c4661000-7f45c4662000 r--p 0005f000 ca:01 125123 /usr/lib64/libpcre.so.1.2.0
7f45c4662000-7f45c4663000 rw-p 00060000 ca:01 125123 /usr/lib64/libpcre.so.1.2.0
7f45c4663000-7f45c466b000 r-xp 00000000 ca:01 15479 /usr/lib64/libcrypt-2.17.so
7f45c466b000-7f45c486a000 ---p 00008000 ca:01 15479 /usr/lib64/libcrypt-2.17.so
7f45c486a000-7f45c486b000 r--p 00007000 ca:01 15479 /usr/lib64/libcrypt-2.17.so
7f45c486b000-7f45c486c000 rw-p 00008000 ca:01 15479 /usr/lib64/libcrypt-2.17.so
7f45c486c000-7f45c489a000 rw-p 00000000 00:00 0
7f45c489a000-7f45c48bb000 r-xp 00000000 ca:01 125150 /usr/lib64/libselinux.so.1
7f45c48bb000-7f45c4abb000 ---p 00021000 ca:01 125150 /usr/lib64/libselinux.so.1
7f45c4abb000-7f45c4abc000 r--p 00021000 ca:01 125150 /usr/lib64/libselinux.so.1
7f45c4abc000-7f45c4abd000 rw-p 00022000 ca:01 125150 /usr/lib64/libselinux.so.1
7f45c4abd000-7f45c4abf000 rw-p 00000000 00:00 0
7f45c4abf000-7f45c4adb000 r-xp 00000000 ca:01 125876 /usr/lib64/libsasl2.so.3.0.0
7f45c4adb000-7f45c4cda000 ---p 0001c000 ca:01 125876 /usr/lib64/libsasl2.so.3.0.0
7f45c4cda000-7f45c4cdb000 r--p 0001b000 ca:01 125876 /usr/lib64/libsasl2.so.3.0.0
7f45c4cdb000-7f45c4cdc000 rw-p 0001c000 ca:01 125876 /usr/lib64/libsasl2.so.3.0.0
7f45c4cdc000-7f45c4cf2000 r-xp 00000000 ca:01 539598 /usr/lib64/libresolv-2.17.so
7f45c4cf2000-7f45c4ef2000 ---p 00016000 ca:01 539598 /usr/lib64/libresolv-2.17.so
7f45c4ef2000-7f45c4ef3000 r--p 00016000 ca:01 539598 /usr/lib64/libresolv-2.17.so
7f45c4ef3000-7f45c4ef4000 rw-p 00017000 ca:01 539598 /usr/lib64/libresolv-2.17.so
7f45c4ef4000-7f45c4ef6000 rw-p 00000000 00:00 0
7f45c4ef6000-7f45c4ef9000 r-xp 00000000 ca:01 125778 /usr/lib64/libkeyutils.so.1.5
7f45c4ef9000-7f45c50f8000 ---p 00003000 ca:01 125778 /usr/lib64/libkeyutils.so.1.5
7f45c50f8000-7f45c50f9000 r--p 00002000 ca:01 125778 /usr/lib64/libkeyutils.so.1.5
7f45c50f9000-7f45c50fa000 rw-p 00003000 ca:01 125778 /usr/lib64/libkeyutils.so.1.5
7f45c50fa000-7f45c5107000 r-xp 00000000 ca:01 539641 /usr/lib64/libkrb5support.so.0.1
7f45c5107000-7f45c5307000 ---p 0000d000 ca:01 539641 /usr/lib64/libkrb5support.so.0.1
7f45c5307000-7f45c5308000 r--p 0000d000 ca:01 539641 /usr/lib64/libkrb5support.so.0.1
7f45c5308000-7f45c5309000 rw-p 0000e000 ca:01 539641 /usr/lib64/libkrb5support.so.0.1
7f45c5309000-7f45c5310000 r-xp 00000000 ca:01 539600 /usr/lib64/librt-2.17.so
7f45c5310000-7f45c550f000 ---p 00007000 ca:01 539600 /usr/lib64/librt-2.17.so
7f45c550f000-7f45c5510000 r--p 00006000 ca:01 539600 /usr/lib64/librt-2.17.so
7f45c5510000-7f45c5511000 rw-p 00007000 ca:01 539600 /usr/lib64/librt-2.17.so
7f45c5511000-7f45c5526000 r-xp 00000000 ca:01 125153 /usr/lib64/libz.so.1.2.7
7f45c5526000-7f45c5725000 ---p 00015000 ca:01 125153 /usr/lib64/libz.so.1.2.7
7f45c5725000-7f45c5726000 r--p 00014000 ca:01 125153 /usr/lib64/libz.so.1.2.7
7f45c5726000-7f45c5727000 rw-p 00015000 ca:01 125153 /usr/lib64/libz.so.1.2.7
7f45c5727000-7f45c5776000 r-xp 00000000 ca:01 127437 /usr/lib64/libldap-2.4.so.2.10.2
7f45c5776000-7f45c5975000 ---p 0004f000 ca:01 127437 /usr/lib64/libldap-2.4.so.2.10.2
7f45c5975000-7f45c5977000 r--p 0004e000 ca:01 127437 /usr/lib64/libldap-2.4.so.2.10.2
7f45c5977000-7f45c5979000 rw-p 00050000 ca:01 127437 /usr/lib64/libldap-2.4.so.2.10.2

7f45c5979000-7f45c5987000 r-xp 00000000 ca:01 127435 /usr/lib64/liblber-2.4.so.2.10.2Aborted (core dumped)

Thanks,
Johnny

Integration tests failing: Curl error code CURLE_SSL_CACERT_BADFILE (77)

I've successfully compiled the SDK on Ubuntu 14.04 x64 (using static linking, out-of-source build). When running e.g. the lambda integration test, no single test succeeds because there seems to be a problem with the included curl implementation. According to the logs, error #77 is returned. Looking that up, it means the following:

CURLE_SSL_CACERT_BADFILE (77)
Problem with reading the SSL CA cert (path? access rights?)

Do I need to import some aws certificates manually beforehand? My aws credentials file is set-up and working, at least with the aws java sdk. I've attached the log from the lambda integration test for reference: aws_sdk_2015-11-13-13.txt

Thanks for any help.

Incorrect path in PersistentCognitoIdentityProvider/FileSystemUtils

I have it on linux when use PersistentCognitoIdentityProvider. Seems slash is missed:

[TRACE] 2015-10-10 15:29:38 FileSystemUtils [140737353856896] Checking HOME for the home directory.
[DEBUG] 2015-10-10 15:29:38 FileSystemUtils [140737353856896] Environment value for variable HOME is /home/eugene
[INFO] 2015-10-10 15:29:38 FileSystemUtils [140737353856896] Creating directory /home/eugene.aws
[DEBUG] 2015-10-10 15:29:38 FileSystemUtils [140737353856896] Creation of directory /home/eugene.aws returned code: 13
[ERROR] 2015-10-10 15:29:38 PersistentCognitoIdentityProvider_JsonFileImpl [140737353856896] Failed reading from file 
[ERROR] 2015-10-10 15:30:02 PersistentCognitoIdentityProvider_JsonFileImpl [140737353856896] Failed reading from file 
[ERROR] 2015-10-10 15:30:02 PersistentCognitoIdentityProvider_JsonFileImpl [140737353856896] Failed persisting changes to file.

Unclear How to Save S3 to Offset

It is very unclear how precisely how one is intended to use the HTTP client to save into a file at some non-0 offset when using the 'SetResponseStreamFactory'.

Specifically, I have a large sparse file (let's say 40gb+) which I would like to fill on-demand. The only examples I can find for dealing with streams are in https://github.com/awslabs/aws-sdk-cpp/blob/master/aws-cpp-sdk-s3-integration-tests/BucketAndObjectOperationTest.cpp and there doesn't appear to be anything near what I need.

In the same train of thought, this nebulous comment kind of worries me... should it?

// The 'truncate' is required to ensure that if the file download IS successful, then it can be written to the
// FStream (if ::trunc is not specified, then the FStream.write fails for some unknown reason)

CodeDeploy generated client capitilization inconsistency breaks builds for case-sensitive operating systems.

/home/jonathan/source/aws-sdk-cpp/aws-cpp-sdk-codedeploy/source/codedeployEndpoint.cpp:15:47: fatal error: aws/codedeploy/CodeDeployEndpoint.h: No such file or directory
#include <aws/codedeploy/CodeDeployEndpoint.h>
^
compilation terminated.
make[2]: *** [aws-cpp-sdk-codedeploy/CMakeFiles/aws-cpp-sdk-codedeploy.dir/source/codedeployEndpoint.cpp.o] Error 1
make[1]: *** [aws-cpp-sdk-codedeploy/CMakeFiles/aws-cpp-sdk-codedeploy.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

Issues setting message attributes on SQS batch send message requests

Setting the message body and attributes on a SendMessageRequest works as expected for me. When I try to send a SendMessageBatchRequest, setting the message body and string attributes on each message, the message body makes it through as expected but no attributes do. I've tried doing this two different ways (there are a few lines of code specific to my repo mixed in here but I think this should be pretty legible... if you can't recreate this and want a self-contained application, I can put one together):

void SQSClient::sendMessageBatch(
        const std::vector<std::string>& messageBody,
        const std::vector<std::map<std::string, std::string>>& attributes)
{
    if (messageBody.size() != attributes.size())
    {
        throw except::Exception(Ctxt("Sizes don't match"));
    }

    SendMessageBatchRequest request;

    std::vector<SendMessageBatchRequestEntry> entries(messageBody.size());
    for (size_t ii = 0; ii < messageBody.size(); ++ii)
    {
        SendMessageBatchRequestEntry entry;
        entry.SetMessageBody(messageBody[ii].c_str());

        const std::string id("some-batch-id-" + str::toString(ii));

        entry.SetId(id.c_str());

        // Try #1
        Aws::Map<Aws::String, MessageAttributeValue> attMap;
        for (auto iter : attributes[ii])
        {
            MessageAttributeValue stringAttributeValue;
            stringAttributeValue.SetStringValue(iter.second.c_str());
            stringAttributeValue.SetDataType("String");

            attMap[iter.first.c_str()] = stringAttributeValue;
        }
        entry.SetMessageAttributes(attMap);

        // Try #2
        for (auto iter : attributes[ii])
        {
            MessageAttributeValue stringAttributeValue;
            stringAttributeValue.SetStringValue(iter.second.c_str());
            stringAttributeValue.SetDataType("String");
            entry.AddMessageAttributes(iter.first.c_str(), stringAttributeValue);
        }

        request.AddEntries(entry);
    }

    request.SetQueueUrl(mQueueUrl);

    // This succeeds, and the message bodies make it through, but no attributes do
    SendMessageBatchOutcome outcome = mSqsClient->SendMessageBatch(request);
}

If I'm just doing something dumb, please let me know. :o)

DateTime::ComputeCurrentTimestampInAmazonFormat() should use system_clock

Visual Studio 2013

double DateTime::ComputeCurrentTimestampInAmazonFormat()
{
    std::chrono::duration<double, std::chrono::seconds::period> now = std::chrono::high_resolution_clock::now().time_since_epoch();
    return now.count();
}

this returned 6-digit numbers in range ~265000 for me while current epoch time is a 10-digit number around 1446523779. In fact high_resolution_clock's epoch is it's host start time, hot Jan 1, 1970 (UNIX epoch), thus using its time_since_epoch in AWS timestamp comparisons makes no sense. To use UNIX epoch, system_clock should be used in place of high_resolution_clock.

For me this bug resulted in not refreshing temporary Cognito identity tokens upon their expiration because here:

bool CognitoCachingCredentialsProvider::IsTimeExpired(double expiry)
{
    using namespace std::chrono;
    //30s grace buffer so requests have time to finish before expiry.
    static const double GRACE_BUFFER = 30.0;   

    return expiry < (Utils::DateTime::ComputeCurrentTimestampInAmazonFormat() - GRACE_BUFFER);
}

right side of a comparison was always less than 10-digit expiry epoch time returned by AWS server. I've checked that if I use system_clock the problem disappears.

aws-cpp-sdk-example1 broken ?

Hi,

I can't wait to build some C++ tools with your sdk, but right now I fail to build the example:

I am building on OS X Yosemite, with CMake (3.3.1) and Clang (Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn).

And I get undefined symbols from the linker:

$ CPLUS_INCLUDE_PATH="../../aws-cpp-sdk-core/include:../../aws-cpp-sdk-dynamodb/include:../../aws-cpp-sdk-cognito-identity/include" LIBRARY_PATH="../../build/aws-cpp-sdk-core:../../build/aws-cpp-sdk-dynamodb:../../build/aws-cpp-sdk-cognito-identity"  make
[ 16%] Linking CXX executable runExample1
Undefined symbols for architecture x86_64:
  "Aws::Auth::ProfileConfigFileAWSCredentialsProvider::GetAccountIdForProfile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      HandleLoginCommand(std::__1::unique_ptr<Aws::Example1::PlayerData, std::__1::default_delete<Aws::Example1::PlayerData> >&, std::__1::unique_ptr<Aws::DynamoDB::DynamoDBClient, std::__1::default_delete<Aws::DynamoDB::DynamoDBClient> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in Main.cpp.o
  "Aws::Utils::Logging::DefaultLogSystem::DefaultLogSystem(Aws::Utils::Logging::LogLevel, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      std::__1::shared_ptr<Aws::Utils::Logging::DefaultLogSystem> std::__1::shared_ptr<Aws::Utils::Logging::DefaultLogSystem>::make_shared<Aws::Utils::Logging::LogLevel, char const (&) [18]>(Aws::Utils::Logging::LogLevel&&, char const (&&&) [18]) in Main.cpp.o
  "Aws::DynamoDB::Model::AttributeValue::SetN(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      Aws::Example1::AttributeBindingBase::SetAttribute(void const*, Aws::DynamoDB::Model::AttributeValue&) const in PlayerData.cpp.o
  "Aws::DynamoDB::Model::AttributeValue::SetS(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      Aws::Example1::DynamoDBDataRowBase::WriteToDb(std::__1::unique_ptr<Aws::DynamoDB::DynamoDBClient, std::__1::default_delete<Aws::DynamoDB::DynamoDBClient> > const&) in DynamoDbDataRow.cpp.o
      Aws::Example1::DynamoDBDataRowBase::ReadFromDb(std::__1::unique_ptr<Aws::DynamoDB::DynamoDBClient, std::__1::default_delete<Aws::DynamoDB::DynamoDBClient> > const&) in DynamoDbDataRow.cpp.o
      Aws::Example1::AttributeBindingBase::SetAttribute(void const*, Aws::DynamoDB::Model::AttributeValue&) const in PlayerData.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [runExample1] Error 1
make[1]: *** [CMakeFiles/runExample1.dir/all] Error 2
make: *** [all] Error 2

It seems there is a little mismatch between version of the example and version of the SDK where, I believe, the code has been refactored to support custom memory allocator:

  • Example for the first error:

The linker is looking for:

Aws::Auth::ProfileConfigFileAWSCredentialsProvider::GetAccountIdForProfile(std::__1::basic_string<char, std::__1::char_traits<char>, **std::__1::allocator<char> > const&**)

But libaws-cpp-sdk-core.dylib defines:

Aws::Auth::ProfileConfigFileAWSCredentialsProvider::GetAccountIdForProfile(std::__1::basic_string<char, std::__1::char_traits<char>, Aws::Allocator<char> > const&)

I hope to be able to provide a fix soon, by the way is there any roadmap for aws-cpp-sdk-samples ?

Best regards.

DynamoDB tests spin forever and fail when running against DynamoDB Local

In TableOperationTest.cpp, I modified line 51 to look like

static const char* ENDPOINT_OVERRIDE = "localhost:8000";

In addition, I also ran DynamoDB Local following instructions in the following page: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Tools.DynamoDBLocal.html#Tools.DynamoDBLocal.DownloadingAndRunning

After compiling and running runDynamoDBIntegrationTests, I get a large number of failed gtest assertions and consequently test failures. They appear to be taking an extremely long time to run as well, which I don't expect (> 15 minutes and still going?).

Please advise if I am doing something wrong as I am new to this particular database service and SDK in general. Thanks.

S3Client::GetObjectAsync doesn't give you access to the data

The callback to S3Client::GetObjectAsync provides a const GetObjectOutcome& which can only provide const GetObjectResult which won't give you access to GetBody. Unless, I'm missing something, this means that if I use GetObjectAsync I can't get the downloaded data? const_casting the problem away seems to work for now...

Documented Example of Enabling Logging Does Not Work

// example.cpp
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/core/utils/logging/DefaultLogSystem.h>
#include <aws/core/utils/logging/AWSLogging.h>

#include <iostream>

int main(int argc, char** argv)
{
  Aws::Utils::Logging::InitializeAWSLogging(Aws::MakeShared<Aws::Utils::Logging::DefaultLogSystem>("RunUnitTests", Aws::Utils::Logging::LogLevel::TRACE, "aws_sdk_"));
  Aws::Utils::Logging::ShutdownAWSLogging();
  return 0;
}
% g++ -std=c++11 example.cpp
example.cpp: In function ‘int main(int, char**)’:
example.cpp:10:116: error: ‘TRACE’ is not a member of ‘Aws::Utils::Logging::LogLevel’
   Aws::Utils::Logging::InitializeAWSLogging(Aws::MakeShared<Aws::Utils::Logging::DefaultLogSystem>("RunUnitTests", Aws::Utils::Logging::LogLevel::TRACE, "aws_sdk_"));

I have looked all through the header files for a reference to TRACE, I can't find references to it in anything but macro's.

Error compiling: fatal error: curl/curl.h: No such file or directory

$ cmake -DCMAKE_BUILD_TYPE=Release .
-- TARGET_ARCH not specified; inferring host OS to be platform compilation target
-- Generating linux build config
-- Dynamic linking enabled
-- Custom memory management enabled; stl objects now using custom allocators
-- Install binary prefix: linux/intel64
-- Configuring done
-- Generating done
-- Build files have been written to: /home/XXXX/third_party/aws-sdk-cpp
$ make
Scanning dependencies of target aws-cpp-sdk-core
[ 0%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/Version.cpp.o
[ 0%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/AmazonSerializableWebServiceRequest.cpp.o
[ 0%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/AmazonStreamingWebServiceRequest.cpp.o
[ 0%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/AmazonWebServiceRequest.cpp.o
[ 0%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/Region.cpp.o
[ 0%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/external/tinyxml2/tinyxml2.cpp.o
[ 0%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/external/json-cpp/jsoncpp.cpp.o
[ 0%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/auth/AWSAuthSigner.cpp.o
[ 0%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/auth/AWSCredentialsProvider.cpp.o
[ 1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/auth/AWSCredentialsProviderChain.cpp.o
[ 1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/client/AWSErrorMarshaller.cpp.o
[ 1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/client/CoreErrors.cpp.o
[ 1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/client/AWSClient.cpp.o
[ 1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/client/ClientConfiguration.cpp.o
[ 1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/client/DefaultRetryStrategy.cpp.o
[ 1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/internal/EC2MetadataClient.cpp.o
[ 1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/http/URI.cpp.o
[ 1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/http/HttpTypes.cpp.o
[ 1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/http/Scheme.cpp.o
[ 1%] Building CXX object aws-cpp-sdk-core/CMakeFiles/aws-cpp-sdk-core.dir/source/http/HttpClientFactory.cpp.o
In file included from /home/john/third_party/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/http/curl/CurlHttpClient.h:20:0,
from /home/john/third_party/aws-sdk-cpp/aws-cpp-sdk-core/source/http/HttpClientFactory.cpp:19:
/home/XXXX/third_party/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/http/curl/CurlHandleContainer.h:23:23: fatal error: curl/curl.h: No such file or directory
compilation terminated.

Signature doesn't match

Hello,

I'm working on Windows 7 x64, the library was built with Visual Studio 2013.

Trying to implement cognito sync client, but I'm getting an error "The request signature we calculated does not match the signature you provided" for ListDatasets method.
For comparison I added dynamoDb client and executed GetItem with same credentials. To my surprise it was completed successfully and there was no such signature error. But both, seems, use the same AWSAuthSigner class.

aws_sdk_2015-09-28-16.log

bool cognitoTest()
{
    Aws::Utils::Logging::InitializeAWSLogging(Aws::MakeShared<Aws::Utils::Logging::DefaultLogSystem>(ALLOCATION_TAG, Aws::Utils::Logging::LogLevel::Trace, "aws_sdk_"));

    ClientConfiguration config;
    config.connectTimeoutMs = 30000;
    config.requestTimeoutMs = 30000;
    config.scheme = Scheme::HTTPS;
    config.region = Region::US_EAST_1;


    auto credentialsProvider = Aws::MakeShared<ProfileConfigFileAWSCredentialsProvider>(ALLOCATION_TAG, credentialsProfileName);
    auto identityClient = Aws::MakeUnique<CognitoIdentityClient>(ALLOCATION_TAG, credentialsProvider, config);

    // Grab an id from the pool
    GetIdRequest getIdRequest;
    getIdRequest.SetAccountId(ProfileConfigFileAWSCredentialsProvider::GetAccountIdForProfile(credentialsProfileName));
    getIdRequest.SetIdentityPoolId(identityPoolId);

    GetIdOutcome getIdOutcome = identityClient->GetId(getIdRequest);
    if(!getIdOutcome.IsSuccess())
    {
        AWS_LOGSTREAM_ERROR(ALLOCATION_TAG, "Failed to allocate identity: " << getIdOutcome.GetError().GetMessage() << "(" << getIdOutcome.GetError().GetExceptionName() << ")" );
        return false;
    }

    Aws::String identityId = getIdOutcome.GetResult().GetIdentityId();

    // Make some credentials from the id
    GetCredentialsForIdentityRequest getCredsRequest;
    getCredsRequest.SetIdentityId(identityId);

    GetCredentialsForIdentityOutcome getCredsOutcome = identityClient->GetCredentialsForIdentity(getCredsRequest);
    if(!getCredsOutcome.IsSuccess())
    {
        AWS_LOGSTREAM_ERROR(ALLOCATION_TAG, "Failed to obtain identity credentials: " << getCredsOutcome.GetError().GetMessage() << "(" << getCredsOutcome.GetError().GetExceptionName() << ")" );
        return false;
    }

    const Credentials& cognitoCredentials = getCredsOutcome.GetResult().GetCredentials();
    auto cognitoIdCredentialsProvider = Aws::MakeShared<SimpleAWSCredentialsProvider>(ALLOCATION_TAG,
                                                                                      cognitoCredentials.GetAccessKeyId(),
                                                                                      cognitoCredentials.GetSecretKey(),
                                                                                      cognitoCredentials.GetSessionToken());

    auto dynamoClient = Aws::MakeUnique<DynamoDBClient>(ALLOCATION_TAG, cognitoIdCredentialsProvider, config);

    // Get item (dynamoDB)
    GetItemRequest getItemRequest;
    getItemRequest.SetTableName("PlayerData");

    AttributeValue keyAttribute;
    keyAttribute.SetS(identityId);
    getItemRequest.AddKey("Identity", keyAttribute);

    GetItemOutcome outcome = dynamoClient->GetItem(getItemRequest);
    if(!outcome.IsSuccess())
    {
        const AWSError<DynamoDBErrors> error = outcome.GetError();
        AWS_LOGSTREAM_INFO(ALLOCATION_TAG, "ERROR, code:" << error.GetMessage().c_str() << "(" << error.GetExceptionName() << ")");
        return false;
    }

    // List datasets (cognito sync)
    auto syncClient = Aws::MakeUnique<CognitoSyncClient>(ALLOCATION_TAG, cognitoIdCredentialsProvider, config);

    ListDatasetsRequest listDatasetsRequest;
    listDatasetsRequest.SetIdentityPoolId(identityPoolId);
    listDatasetsRequest.SetIdentityId(identityId);

    ListDatasetsOutcome listOutcome = syncClient->ListDatasets(listDatasetsRequest);
    if(!listOutcome.IsSuccess())
    {
        AWS_LOGSTREAM_ERROR(ALLOCATION_TAG, "Failed to list datasets: " << listOutcome.GetError().GetMessage() << "(" << listOutcome.GetError().GetExceptionName() << ")" );
        return false;
    }

    Aws::Utils::Logging::ShutdownAWSLogging();
    return true;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.