Giter VIP home page Giter VIP logo

Comments (6)

malpani avatar malpani commented on July 27, 2024

Jest might be useful here. Relevant links
[1] searchbox-io/Jest#248
[2] https://github.com/inreachventures/aws-signing-request-interceptor

from amazon-elasticsearch-lambda-samples.

stevesloka avatar stevesloka commented on July 27, 2024

But what if I don't want to use Jest? I have my app written to use plain rest calls. Does the sdk facilitate a way to sign the requests (or generate the headers) for me? I want to stick to the sdk so as things change, I don't have to constantly update custom code.

Is there an HttpRequest method in the sdk?

from amazon-elasticsearch-lambda-samples.

stevesloka avatar stevesloka commented on July 27, 2024

Hey @malpani I updated to use Jest and the request interceptor and that works. BUT, when I use credentials from "EnvironmentVariableCredentialsProvider" I get at 403 "message":"The security token included in the request is invalid.".. When I use my personal credentials it works fine. I've setup my execution role to have the following permissions (note I've removed my private data inside the carrots). Is there anything further to setup to allow my execution role to access elastic?

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "logs:CreateLogGroup",
                "logs:CreateLogStream",
                "logs:PutLogEvents"
            ],
            "Resource": "arn:aws:logs:*:*:*"
        },
        {
            "Effect": "Allow",
            "Action": [
                "s3:GetObject",
                "s3:PutObject"
            ],
            "Resource": [
                "arn:aws:s3:::*"
            ]
        },
        {
            "Effect": "Allow",
            "Action": "es:*",
            "Resource": [
                "arn:aws:es:us-east-1:<account>:domain/<domain>/*"
            ]
        }
    ]
}

from amazon-elasticsearch-lambda-samples.

malpani avatar malpani commented on July 27, 2024

Native java SDK relies on binary protocol and I don't think it has an HttpClient.

Regarding the error you see, I have personally not used the request interceptor and it might be worth reporting an issue at https://github.com/inreachventures/aws-signing-request-interceptor with the code snippet for invoking it

from amazon-elasticsearch-lambda-samples.

jrask avatar jrask commented on July 27, 2024

Any updates on this? Is it really that hard to accomplish this from Java?

from amazon-elasticsearch-lambda-samples.

stevesloka avatar stevesloka commented on July 27, 2024

I was able to get it working with the Jest client and using the REST interface.

from amazon-elasticsearch-lambda-samples.

Related Issues (17)

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.