I have a simple spring boot app which has just 2 rest controllers and I am exporting the war for the same. I am deploying the same war using the tomcat manager on EC2 instance on AWS, but unfortunately I am getting http status 404 when trying to hit the API. URL that I am trying to hit is –
Tag: amazon-web-services
‘Profile file contained no credentials for profile’ error when doing PutItem using AWS Java SDK
I’m trying to put an item into a DynamoDB table using the AWS SDK for Java. I am using the EnhancedPutItem.java example from the docs: When running locally I can put the item successfully, but when I run my application as a task on Fargate, it throws this error: software.amazon.awssdk.core.exception.SdkClientException: Profile file contained no credentials for profile ‘default’: ProfileFile(profilesAndSectionsMap=[]). Answer
Uploading json content on s3 using presigned url – gzipped
On the backend i’m generating a presigned url to upload a json object to an s3 bucket. I want the body actual json to be compressed. This is what i’m doing in the backend: Now, in postman, I manually add the content-encoding: gzip header and the file gets uploaded Issues: 1. If i go to the aws console and try
Mapping List to DynamoDB
I’m trying to map to DynamoDB list of dates in Java I have written my own converter but it works only for LocalDateTime but not for the List. Does anyone know how to do it correctly? Should I write separate converter that will return list of strings where each string will be converted from localdatetime? Answer I wrote converter like
Why did I get exception when I access CloudTrail Events ? Thanks
Exception: com.amazonaws.services.cloudtrail.model.AWSCloudTrailException: The security token included in the request is invalid. (Service: AWSCloudTrail; Status Code: 400; Error Code: UnrecognizedClientException; the sample code : awsCredentials (accessKey, SecretAsscessKey) is the temporary credential I got through AssumeRole (RoleA). RoleA has the priviliage to access LookupEvents in CloudTrail. The exception comes from the lookupEvents call. I ensure the credential doesn’t expire when I call
SqsListener doesn’t pick up any messages from SQS Queue
I’m trying to implement a queue through SQS for my project, sending to the queue works just fine, but receiving from the queue isn’t working at all. It seems the receiver has absolutely no connection to the queue at all Config Consumer Method Maven Dependencies I’ve gone through numerous Stack Overflow posts on the topic already, haven’t found a solution.
X-Ray trace doesn’t shows inner method call
I’m new to aws x-ray and trying to use x-ray with AOP based approach in a springboot application. I was able to get the traces in the aws console, but traces doesn’t show inner method call method2() details. Am I missing anything here. Controller class Aspect Class When I hit http://localhost:8080/xray/method1 endpoint, AWS Xray Console doesn’t show method2() details Answer
S3 bucket given name versus physical name Cloudformation
I created a bucket with name “my-bucket”, cloudformation creates it as “StackName-my-bucket-{random text}”. I want to read from this bucket in the java code, what would be the right way to access provided I cannot touch anything in cloudformation. Answer Assuming you cannot modify the CloudFormation template and it does not have the bucket as an output variable – You
Java Lambda for spring-cloud version to 3.2.3/3.1.7 org/springframework/boot/ApplicationContextFactory: java.lang.NoClassDefFoundError
I’m trying change version for spring-cloud-function-adapter-aws from 3.0.7.RELEASE to either 3.1.7 or 3.2.3 (as Spring Cloud Function Vulnerability CVE-2022-22963) but getting error as it is not able to find the class java.lang.NoClassDefFoundError: org/spring framework/boot/ApplicationContextFactory at org.springframework.cloud.function.context.FunctionalSpringApplication.(FunctionalSpringApplication.java:67) at org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer.springApplication(AbstractSpringFunctionAdapterInitializer.java:378) at org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer.initialize(AbstractSpringFunctionAdapterInitializer.java:121) at org.springframework.cloud.function.adapter.aws.SpringBootStreamHandler.initialize(SpringBootStreamHandler.java:61) at org.springframework.cloud.function.adapter.aws.SpringBootStreamHandler.handleRequest(SpringBootStreamHandler.java:53) Caused by: java.lang.ClassNotFoundException: My Application.java @SpringBootApplication public class Application { } FunctionConfiguration.java @Configuration public class FunctionConfiguration
How to add a Servlet filter in Vert.x REST API?
I have a REST API which was created purely using Vert.x, I would like to instrument it for AWS X-RAY and in order to do that I need to add a servlet filter. I’m creating a webserver like this: In the documentation for AWS X-RAY they’ve only mentioned Tomcat (https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-java-filters.html). Would adding filters using web.xml work for this as well