Reputation: 1
I am running a Spring Boot application and using Spring boot cassandra to connect to keyspace. Following are the properties being used:
spring.data.cassandra.contact-points=cassandra.us-east-2.amazonaws.com
spring.data.cassandra.port=9142
spring.data.cassandra.ssl=true
I am passing cassandra truststore key as vm argument. From my local dev environment it works perfectly fine without any issue.
When I created a docker image with exactly same cassandra configuration and deployed it in AWS cloud (using ECS) it fails every time with following exception Invocation of init method failed; nested exception is com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: cassandra.us-east-2.amazonaws.com/3.12.23.159:9142 (com.datastax.driver.core.exceptions.TransportException: cassandra.us-east-2.amazonaws.com/3.12.23.159:9142 Cannot connect)-
Here also I am passing trustore key as vm argument and verified certificate as well by enabling log. Can some one please help me with this issue.
Upvotes: 0
Views: 443
Reputation: 812
Use the following container as a reference on how to setup a container
https://github.com/aws-samples/amazon-keyspaces-toolkit
For Java apps you may need to add the pem to the truststore with the additional info
RUN mkdir $CQLSHRC_HOME
RUN yum install -y openssl && \
yum install -y java-1.8.0-openjdk && \
yum install -y tar
#create jks truststore
RUN openssl x509 -outform der -in $CQLSHRC_HOME/AmazonRootCA1.pem -out temp_file.der && \
keytool -import -alias new-cassandra -keystore $CQLSHRC_HOME/cassandra_truststore.jks -file temp_file.der -storepass amazon -noprompt
ENV javax.net.ssl.trustStore=$CQLSHRC_HOME/cassandra_truststore.jks
ENV javax.net.ssl.trustStorePassword=amazon
Upvotes: 1