spring-cloud-aws | The New Home for Spring Cloud AWS | Microservice library
kandi X-RAY | spring-cloud-aws Summary
kandi X-RAY | spring-cloud-aws Summary
Spring Cloud AWS, part of the Spring Cloud umbrella project, eases the integration with hosted Amazon Web Services. It offers a convenient way to interact with AWS provided services using well-known Spring idioms and APIs, such as the messaging or caching API. Developers can build their application around the hosted services without having to care about infrastructure or maintenance.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Entry point for the download
- Downloads a file from a URL
- Entry point to the class
- Adds overridden methods
- Creates message headers for given message
- Set default headers for SQS
- Sends a message to SNS
- Transforms a message into an SNS message attributes
- Closes the local output stream
- Creates a new multipart upload request
- Polls and emits messages
- Release permits for the queue
- Start the background thread
- Put an entry into the cache
- Starts the executor
- Starts the container
- Resolves an argument
- Stop polling
- Sends an email
- The default SqsMessageListenerFactory bean
- Start application runner
- The application runner
- Resolve profiles specific configurations
- Resolve profile specific configurations
- Uploads an object to a S3 resource
- Start this service
spring-cloud-aws Key Features
spring-cloud-aws Examples and Code Snippets
Community Discussions
Trending Discussions on spring-cloud-aws
QUESTION
(SCDF 2.7.1 & Skipper 2.6.1) Deployment -> Local Kubernetes Instance
(Starter App) Applications version 3.0.1 kafka docker
Created a stream S3 Source -> Log, on deploy the 'S3 Source' app throws below exception. But the stream gets deployed and works as expected. Any info on how to get rid of the exception.
...com.amazonaws.SdkClientException: Failed to connect to service endpoint: at com.amazonaws.internal.EC2ResourceFetcher.doReadResource(EC2ResourceFetcher.java:100) ~[aws-java->sdk-core-1.11.792.jar:na] at com.amazonaws.internal.EC2ResourceFetcher.doReadResource(EC2ResourceFetcher.java:70) ~[aws-java->sdk-core-1.11.792.jar:na] at >com.amazonaws.internal.InstanceMetadataServiceResourceFetcher.readResource(InstanceMetadataServiceResour>ceFetcher.java:75) ~[aws-java-sdk-core-1.11.792.jar:na] at com.amazonaws.internal.EC2ResourceFetcher.readResource(EC2ResourceFetcher.java:66) ~[aws-java-sdk->core-1.11.792.jar:na] at com.amazonaws.util.EC2MetadataUtils.getItems(EC2MetadataUtils.java:402) ~[aws-java-sdk-core->1.11.792.jar:na] at com.amazonaws.util.EC2MetadataUtils.getData(EC2MetadataUtils.java:371) ~[aws-java-sdk-core->1.11.792.jar:na] at >org.springframework.cloud.aws.context.support.env.AwsCloudEnvironmentCheckUtils.isRunningOnCloudEnvironm>ent(AwsCloudEnvironmentCheckUtils.java:38) ~[spring-cloud-aws-context-2.2.6.RELEASE.jar:2.2.6.RELEASE] at >org.springframework.cloud.aws.context.annotation.OnAwsCloudEnvironmentCondition.matches(OnAwsCloudEnviro>nmentCondition.java:38) ~[spring-cloud-aws-context-2.2.6.RELEASE.jar:2.2.6.RELEASE] at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:108) >~[spring-context-5.2.13.RELEASE.jar:5.2.13.RELEASE] at >org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader$TrackedConditionEvaluator.>shouldSkip(ConfigurationClassBeanDefinitionReader.java:477) ~[spring-context->5.2.13.RELEASE.jar:5.2.13.RELEASE] at >org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConf>igurationClass(ConfigurationClassBeanDefinitionReader.java:131) ~[spring-context->5.2.13.RELEASE.jar:5.2.13.RELEASE] at >org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(Config>urationClassBeanDefinitionReader.java:120) ~[spring-context-5.2.13.RELEASE.jar:5.2.13.RELEASE] at >org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(Conf>igurationClassPostProcessor.java:331) ~[spring-context-5.2.13.RELEASE.jar:5.2.13.RELEASE] at >org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry>(ConfigurationClassPostProcessor.java:236) ~[spring-context-5.2.13.RELEASE.jar:5.2.13.RELEASE] at >org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostPr>ocessors(PostProcessorRegistrationDelegate.java:280) ~[spring-context-5.2.13.RELEASE.jar:5.2.13.RELEASE] at >org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(Po>stProcessorRegistrationDelegate.java:96) ~[spring-context-5.2.13.RELEASE.jar:5.2.13.RELEASE] at >org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractA>pplicationContext.java:707) ~[spring-context-5.2.13.RELEASE.jar:5.2.13.RELEASE] at >org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:5>33) ~[spring-context-5.2.13.RELEASE.jar:5.2.13.RELEASE] at >org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServer>ApplicationContext.java:143) ~[spring-boot-2.3.9.RELEASE.jar:2.3.9.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) ~[spring-boot->2.3.9.RELEASE.jar:2.3.9.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) ~[spring-boot->2.3.9.RELEASE.jar:2.3.9.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:405) ~[spring->boot-2.3.9.RELEASE.jar:2.3.9.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot->2.3.9.RELEASE.jar:2.3.9.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) ~[spring-boot->2.3.9.RELEASE.jar:2.3.9.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot->2.3.9.RELEASE.jar:2.3.9.RELEASE] at >org.springframework.cloud.stream.app.s3.source.kafka.S3SourceKafkaApplication.main(S3SourceKafkaApplicat>ion.java:29) ~[classes/:na] Caused by: java.net.SocketTimeoutException: connect timed out at java.base/java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:na] at java.base/java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) ~[na:na]
ANSWER
Answered 2021-Mar-10 at 20:49This is a known issue, but I'm not sure how to fix it, since it occurs in the amazon SDK. I recommend you submit an issue in github so we can track it.
QUESTION
I have an SqsListener using a custom QueueMessageHandlerFactory with a message converter to go from JSON to POJO and back. If for whatever reason the listener method can't parse the JSON body in a message, it will throw a org.springframework.messaging.converter.MessageConversionException. I want to catch this exception and log it properly. I know that JMS listeners allow you to add a custom ErrorHandler as part of the Factory definition.
Is there a similar way to define a custom ErrorHandler to catch this exception using Spring's SqsListener and log it?
Thanks!
...ANSWER
Answered 2020-Dec-07 at 20:33Nevermind, seems like all I need to do is add a @MessageExceptionHandler annotation to my custom handler:
QUESTION
I am trying to run a Spring Application but it keeps throwing this error:
"Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: org/apache/log4j/Logger] with root cause
java.lang.ClassNotFoundException: org.apache.log4j.Logger"
Below is the stack trace of the error.
...ANSWER
Answered 2020-Oct-05 at 08:34Ok. The faulty line here is:
QUESTION
I have an existing SpringBoot Application that was running with no issue. I then created a Java library—a standalone repository with only static Java code, no main class. My library is deployed as a GitHub Maven package.
I then proceeded with setting up my GitHub packages repository in my local Maven settings and added the dependency to my original SpringBoot application. The import process is successful, my library's Jar is in the classpath and compilation and build are successful.
What happens next is I run the application now, and I get the following stacktrace:
...ANSWER
Answered 2020-Sep-19 at 18:51You're using different versions of spring-boot-starter-parent (2.3.1.RELEASE and 2.3.4.RELEASE) which is probably leading to inconsistent versions where the later or earlier don't have the method. Try using 2.3.4.RELEASE in your application.
[Update]
You're still getting inconsistent versions of org.springframework:*
on the classpath:
QUESTION
I am Using Spring Cloud Data Stream and Kinesis Spring Binder to connect to Kinesis: https://github.com/spring-cloud/spring-cloud-stream-binder-aws-kinesis/blob/master/spring-cloud-stream-binder-kinesis-docs/src/main/asciidoc/overview.adoc By default, it uses aws-sdk 1.11.415 and which can't be used for Assumed Role while deploying in Kubernetes environment (AWS EKS). I have figured out that I need to upgrade the library to aws-sdk 1.11.844 to support the WebIdentityToken based credential provider. This is working in Kubernetes. Now from my local machine, I am trying to connect to Kinesis by enabling instance profile (disabling the WebIdentityToken based flow), it keeps on throwing below error and not connecting. when I comment this upgraded library it goes back to aws-sdk 1.11.415 which is working as expected. But I need to upgrade this for WebIdentityToken based credential provider.
Please help me if anybody having any solution for this. I can't change to AWS SDKV2 as Spring Binder will not support that. Any other solution will be helpful.
...ANSWER
Answered 2020-Sep-02 at 22:28The problem is that your local machine doesn't have an instance profile.
If you look at the stack trace, you'll see EC2MetadataUtils.getItems()
. This is trying to read from the instance metadata endpoint, http://169.254.169.254
. On an EC2 instance that returns quickly; on your local machine it will time-out because that IP address doesn't exist.
If you're looking to consume AWS services from your local machine, you will have to use a credentials provider that retrieves the information locally. I recommend using DefaultAWSCredentialsProviderChain, which looks for local configuration (either in $HOME/.aws
or via environment variables or system properties), and also supports instance profiles (in case you're running on an EC2 instance).
QUESTION
I have a Spring Boot, Spring Cloud AWS service, written to receive messages from an AWS SQS queue. Everything has been working fine within my own personal AWS account services with region set to "us-east-1", but when switching over to AWS GovCloud region "us-gov-east-1", receiving error message "The region 'us-gov-east-1' is not a valid region". Tracked down the problem to be related to pulling a real old version of the aws-java-sdk-core-1.11.415 library that does not contain the new GovCloud region within its Regions.enum object. Not really sure why this project is pulling in a very old transitive dependency of aws-java-sdk-core-1.11.415, as I believe the Spring-Cloud project is set to pull in aws-java-sdk-core-1.11.7xx. Granted, I may have done something wrong in my pom.xml configuration, but I can't seem to figure out why the project is pulling in an old old version of the aws-java-sdk-core library.
I have been running for intial testing purposes with my default region set to with no problems:
...ANSWER
Answered 2020-Jun-23 at 09:50To track down where did the old version of AWS Java SDK leaked in your code execute mvn dependency:tree
. Study the tree and look where it comes from.
To force the latest version of AWS Java SDK, import its BOM to your dependenciesManagement
:
QUESTION
I'm having some drama when running the listObjects(..) method of AmazonS3. I'm certain that my credentials are set up correctly as I am able to download individual files using s3Client.getObject(..). The logs read::
com.amazonaws.SdkClientException: Failed to parse XML document with handler class
com.amazonaws.services.s3.model.transform.XmlResponsesSaxParser$ListObjectsV2Handler
Caused by: org.xml.sax.SAXParseException: Premature end of file.
I understand that listObjects(..) does include in it's response some xml containing meta data. The code to reproduce the error is very simple. I can't see anything wrong here :(
ListObjectsRequest listObjectsRequest = new ListObjectsRequest() .withBucketName(ENV.getProperty("cloud.aws.s3.bucket"));
ObjectListing objectListing = amazonS3Client.listObjects(listObjectsRequest);
Here is the version of spring-cloud-aws-context I am using::
org.springframework.cloud
spring-cloud-aws-context1.2.1.RELEASE
Does anybody have any insight? Or know away around this issue?
Thanks in advance :)
...ANSWER
Answered 2020-Mar-10 at 22:04Ok, I found the solution! The problem was with the permissions, apparently listObjects(..) requires it's own set of permissions. Specifically the 'ListBucket' action must be enabled.
QUESTION
I am getting the below error when I am trying to run a Spring boot-AWS application locally :
There is not EC2 meta data available, because the application is not running in the EC2 environment. Region detection is only possible if the application is running on a EC2 instance
My aws-config.xml looks like below :
...ANSWER
Answered 2017-Aug-24 at 05:44Found the Issue. I was using spring-cloud-starter-aws-messaging for SQS messaging. The above dependency includes many Auto Detect classes which eventually was firing up even if they were not required.
Instead I have used spring-cloud-aws-messaging which solved the issue along with many other auto detect issues.
QUESTION
I have a requirement to retrieve credentials from AWS Secret Manager, and I found that I need to add the gradle dependency for the following starter
...ANSWER
Answered 2019-Jun-05 at 01:42I would like to share my findings on SecretManager integration with Spring Boot application.
Step 1. Add spring-cloud-starter-aws-secrets-manager-config
dependency in Spring Boot Application ( Gradle and Maven ways of adding dependency is different).
Step 2. Add the following configuration in bootstrap.yml file.
QUESTION
I'm using the High Level Rest client from Spring-Boot. Specific version is 7.1.1 against an ES v6.4.3
I'm getting the following error when I try to do a BulkRequest which are all IndexRequests
...ANSWER
Answered 2019-Jun-04 at 20:12From the stacktrace I see that you are using Spring Boot 2.1.3. which uses Elasticsearch 6.4.3.
You are then changing the RestHighLevelClient version to 7.1.1 but leave the version of org.elasticsearch:elasticsearch
unchanged, that is where BulkRequest
comes from. And the BulkRequest
class in version 6.4.3 does not have a method named String pipeline()
, whereas in version 7.1.1 this method exists.
So you need to change the version for this dependency (and if you need other elasticsearch libs check them too) as well:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install spring-cloud-aws
Default Checkstyle rules
File header setup
Default suppression rules
Project defaults for Intellij that apply most of Checkstyle rules
Project style conventions for Intellij that apply most of Checkstyle rules
checkstyle.header.file - please point it to the Spring Cloud Build’s, spring-cloud-build-tools/src/main/resources/checkstyle-header.txt file either in your cloned repo or via the https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle-header.txt URL.
checkstyle.suppressions.file - default suppressions. Please point it to the Spring Cloud Build’s, spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml file either in your cloned repo or via the https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml URL.
checkstyle.additional.suppressions.file - this variable corresponds to suppressions in your local project. E.g. you’re working on spring-cloud-contract. Then point to the project-root/src/checkstyle/checkstyle-suppressions.xml folder. Example for spring-cloud-contract would be: /home/username/spring-cloud-contract/src/checkstyle/checkstyle-suppressions.xml.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page