The Amazon S3 docs in the Java V2 Developer Guide state that you can use ApacheHttpClient.
https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/http-configuration.html
However, I am not sure how to bind that with the S3Client object. Can someone please show me the proper logic?
There are examples of using ApacheHttpClient when creating an AWS Service Client in Java V2. Included in this doc is the dependencies that you need as well.
See the examples under Specify the HTTP client to use at client creation time.
https://aws.amazon.com/blogs/developer/aws-sdk-for-java-2-x-released/
Related
I am using the AWS Java SDK v1 to access a Step Function.
Unfortunately I am getting this error about the region.
In my script file I defined like this.
private AWSStepFunctions client;
this.client = AWSStepFunctionsClientBuilder.defaultClient();
In application.properties I defined like this.
cloud.aws.region.static=eu-central-1
aws.region=eu-central-1
The code you are using is an old API and no longer considered best practice. Amazon Strongly recommends using V2 over V1.
The way you are creating a service client is outdated too. To programmatically work with AWS Step Functions, consider using the recommended API - which is AWS SDK for Java v2.
To create an AWS Step Functions Service Client and specify the Region, use Java code like this:
Region region = Region.US_EAST_1;
SfnClient sfnClient = SfnClient.builder()
.region(region)
.build();
See the AWS Step Functions Readme here for more set up instructions for AWS SDK Java V2.
I'm using google cloud functions with no problem in my mobile app using specific sdk for iOS and swift. For integrations reason I would now need to call one of my functions from a java springboot server.
I cannot find any example for that, does a specific client and example exist ?
I can find examples for other platform but not for java. Am I missing something ? can someone move me in the right direction ?
Thanks
You could simply do HTTP requests, that will trigger the cloud functions. Here is the documentation
GCP has documentation regarding the authentication on Cloud Functions. Since you need to authenticate on a Cloud Function from a VM inside your GCP project, I recommend you to read this section.
As explained, you should get an Identity Token that can authenticate on Cloud Functions. You can fetch the token either from gcloud or the metadata server. After you have that in whatever format you can access it without compromising your credentials (e.g. environment variable, file outside the repository) just perform the HTTP request to the trigger of the function.
In the end you should have something like this:
cf_trigger = "https://<region>-<project_id>.cloudfunctions.net/<function_name>"
identity_token = "foo"
HttpRequest.newBuilder()
.uri(URI.create(cf_trigger))
.header("Authorization", "bearer " + identity_token)
.build();
I am not able to figure out how to make api calls to amazon elastic transcoder pipeline in java.What should be the base url for the service call or should i make the pipelines manually using the console and create jobs through my code.
You could refer to the API Reference docs and create your own client using any HTTP library, but ideally, you would use the Java SDK for AmazonElasticTranscoderClient, not create your own REST clients.
Specifically, you would want the createPipeline(CreatePipelineRequest request) method
The endpoints for all AWS services are listed on a single page
I have the following endpoint that a client sent me:
https://{restapi_id}.execute-api.{region}.amazonaws.com/test/v1/items?type=ABC
Since this request needs to be called with the AWS Authorization process I wanted to use the API Gateway SDK, but I can't find a straightforward example on how to call it.
I was able to successfully test the API call using Postman (as exaplained in the AWS docs), but I don't know how to specify it using the SDK.
The ENDPOINT should be the full URL?
How should I make a call beyond this code? I tried using the GetResourceRequest, but that doesn't seem right. If so, what part of this URL I have is the resource?
This is code where I'm stuck with:
BasicAWSCredentials awsCreds = new BasicAWSCredentials(ACCESS_KEY, SECRET_KEY);
AmazonApiGatewayClient api = new AmazonApiGatewayClient(awsCreds);
api.setRegion(Region.getRegion(Regions.US_EAST_1));
api.setServiceNameIntern("execute-api");
api.setEndpoint(ENDPOINT);
Here's an open-source generic SDK you can use to do this: https://github.com/rpgreen/apigateway-generic-java-sdk
You can also generate your own SDK as per https://aws.amazon.com/blogs/developer/api-gateway-java-sdk/
AmazonApiGatewayClient is for managing the apis, you cannot use it to call your api.
We just launched support to generate a Java SDK for an apis, you can use that to call your api (link to docs). Note that you need to generate the SDK from the export tab in the stage.
I want to use GAE datastore to store my data but instead of the java API we want to use the JSON API and making requests through spray.
But before I can even do any request I need to obtain an access token.
I can't figure out how this is done with either the Java API or any other means. Is there a way to obtain an access token which can then be used for the JSON API (through spray)?
Like many Google services, the Datastore API uses OAuth for authentication. The easiest way to use it is with one of the Google API client libraries.
Java: https://developers.google.com/api-client-library/java/
Java + Datastore: https://developers.google.com/api-client-library/java/apis/datastore/v1beta2
The documentation for the client does a pretty good job of explaining how OAuth works and how to get started calling APIs by registering your app with the Console.
(I'm not familiar with spray, but I assume you'd be able to use the Java client from Scala.)