Connection pooling on glassfish server running on an Amazon ec2 instance - amazon-web-services

I had previously developed an application that I deployed on an aws beanstalk. The beanstalk ran on a tomcat server. In order to enable connection pooling in the application I followed this blog https://aws.amazon.com/blogs/aws/customize-elastic-beanstalk-using-configuration-files/ and wrote a config file to replace the server.xml file of the tomcat running on the ec2 instance. This worked perfectly for me. I am now trying to do the same thing but for an application that runs on a glassfish server. I know that I have to replace the glassfish-resources.xml file of the server but I cant figure out the path to the file on the ec2 instance. Can anyone help me with this? Thanks.

Related

Running an ec2 instance from other server provider existing image

I have installed ressources on a scalway server scaleway.com (a frensh servers and cloud provider). This server uses ubuntu as os and runs a python app with many installations and configs.
In scalway, you can run a new server from a server image you had before installed or already existing. In ec2 too, you can surely launch an aws ec2 instances from an existing AMI https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html.
But, is there a way please to launch an ec2 instance with a scalway image. It will save much time in deployment of the app.
Thanks.
It seems that there is no way:
https://www.reddit.com/r/Scaleway/comments/jwha9q/is_there_a_way_to_download_an_image/

JPA cannot connect to AWS RDS from Beanstalk but it works locally

I'm deploying a Java 8 Spring Boot web app to AWS Elastic Beanstalk. I have an associated RDS MySQL instance and configured the relevant connection details.
The connection works when running the app locally, in my machine, because I set the following routing configuration for the RDS server:
As outlined, routings are also added for the security groups associated to my EC2 instances.
Therefore, running mysql on the EC2 machine works and the database can be reached.
The issue appears when deploying the app to Beanstalk, where it gets implemented into the EC2 instances. The app crashes because it gets connection refused errors when trying to connect to the MySQL RDS instance:
This doesn't seem to make any sense.
The database is accessible from both the EC2 instance (verified via the mysql command) and outside AWS, so the only remaining cause would be having misconfigured the Spring Boot app properties.
This doesn't seem to be the problem either because when running it locally, in my machine, the app has no issues connecting to the RDS instance and running normally using the production MySQL server.
I have separate application-development.properties and application-production.properties files, but I set the relevant properties to the same values:
spring.datasource.url = jdbc:mysql://XXXXXX.rds.amazonaws.com:3306/ebdb?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
spring.datasource.username = XXXXXX
spring.datasource.password = XXXXXX
spring.datasource.driver-class-name = com.mysql.cj.jdbc.Driver
Any pointers as to why my app could be running locally but not when deployed to Beanstalk?
Recreating both the Beanstalk environment and RDS instance seemed to fix the issue.

Unable to make API requests in AWS EC2 Windows instance

I have made a spring boot REST API (as a jar file) which links to MongoDB compass installed on the same EC2 instance.
When I run the jar file (in cmd) on my Windows 10 laptop (not the EC2 instance), it works totally fine and I'm able to make the http requests with Postman (from my IP). And when I run the jar file on my EC2 instance with cmd, it still runs normal and everything seems fine.
But this time I'm unable to make the http requests from anywhere. Postman says Could not send request Error: Request timed out.
I've tried using both the public IP and Public DNS IP. Going through the other solutions to questions similar as mine, I got to know that I'd to add inbound rules for all the ports which I'm using (8080 and 27017 in my case). I also enabled stuff from Windows Firewall in the EC2 instance but nothing helps me at the end.
Any help would be really appreciated.

Where do I put my Spring Boot REST API jar file on my Ubuntu EC2 instance?

I have an Ubuntu EC2 instance on which I want to place a Spring Boot REST API jar file, which I've built on my computer. I'm going to use Filezilla to transfer the jar file over SFTP to my Ubuntu EC2 instance. Does it need to go into a certain directory if I want to use that EC2 instance for sending HTTP request to the REST API?
I think you're trying to send request to REST API from Spring Boot application which is included in Ubuntu EC2 instance. You don't need to put spring boot application in a specific directory. Make sure that you've installed java in EC2 instance. You just have to run spring boot application and open port 8080 (for embedded tomcat server) from the security group. Most importantly you've to check whether EC2 instance was launched in public subnet.

Database connections with RDS not working after deploying

I have developed a Dynamic web App, which leverages Amazon RDS. Servlet talks with RDS fetches data and presents it using JSP. The process is working fine. Next, I uploaded the war file of project on AWS Elastic beanstalk. But Database connections are not working.
Could you please guide me here? Why my connection variables are not working after deploying?
I made few changes to the early deployment and now App takes forever to load.