i am new in aws. i created one ec2 instance and installed tomcat7, deployed java web application. after i want change inside my application like db.property file. how to change through java api.my all files are available in ebs volume. how to get particular file and modify and update through java programmatic.
Thanks,
Sriram
The AWS API doesn't let you access EBS volume contents directly. You need to log into the machine and make the changes.
If it's a Linux machine, you can do so via SSH.
You can use a command-line SSH client or an SSH client library, such as Jsch for Java.
Related
our use case needs to upload file from our on-premise server to an AWS EC2. Tried doing some research and could not find any available code samples on how to do this in Java. Has anyone done this before? and if yes and you direct me to some code template or sample codes I can use as basis.
We are using Java 8 by the way. Our EC2's VPC is connected to our on-premise network so for sure our on-premise server can see it.
If you don't have any specific services installed on your EC2 instance and want to push files to EC2 (instead of pulling from other services like S3), you could transfer files using the SSH protocol.
You can use jsch which is a Java library that implements SSH. There are many examples on the jsch website showing how to use jsch, also specific ones showing file transfers.
I have an application in the Application Server that can be installed by any Client PC. I want to know, once the App was installed in the Client Java Cache, Is there a way I can access a file inside the Clients Java Cache to compare to the Application Server? This file controls the version no of the application.
Thanks in advance...
My friend and me want to explore an Open Source ERP System. We have installed it on a server and we access it by an IP address over Firefox. We're also accessing it over the tools putty (for doing changes like restarting tomcat) , Filezilla (for import export of data), pgAdmin (for accessing the psql db). Now we want to establish a java Eclipse developer environment on both our windows pcs working simultaneously. I need to access, change and commit to the source placed on the server. Every time I commit, I need to deploy the source code with putty.
1) Is there a better way of this way of remote programming? If yes, could you tell me a better way?
2) If not, how can I set this kind of environment in Eclipse (Create an existing project?)
You need configure Jenkins Which will deploy the latest code into remote server
You can use Ansible to automate your deploy
I have an application running on a server which is doing stuff and writing everything it does to a log file.
I also have secondary application which is kind of like a monitoring panel also running on the server but is a different process. What I would like to do is the following:
I would like my monitoring file to be able to copy the log file which currently has a lock on it from the other application and then email it to me.
I have tried using scp to connect to the server and copy it manually to my computer(and it did work), however I would like to be able to do that through my java monitoring application. And I have no idea where to start.
I have tried using scp to connect to the server and copy it manually to my computer(and it did work)
The JSch library has a ScpFrom module that you can use to scp copy the data from the server to your computer or application. This can be done by one of the following:
Manually running the module (eg java -jar)
Copying the source of the module into your project and adding the JSch library to classpath (more programmatic control - preferred approach)
Using the library module programmatically eg String[] args = {user#remotehost:file1" "localfile"}; SCPFrom.main(args);
I am trying to use java sdk to create a local filesystem on an EC2 machine which would actually be a S3 resource
I have already written code to start EC2 machine, create security groups, keys etc but now want to mount a S3 on top of that EC2 machine that I create using java SDK. There seems to be no detailed solution online.
First, you should prepare your own AMI with s3fs pre-installed. See https://forums.aws.amazon.com/thread.jspa?threadID=39361. The EC2 instance should be started from this custom AMI.
Second, right after the instance is up and running, you should establish an SSH connection to it and run
/usr/bin/s3fs bucketname /mnt/mountpoint
I would recommend to use JSch
While there is a file system provider s3fs build on fuse. Is not always a good idea to try to mount it to the file system. Instead you should either use command line tools s3cmd or build in access to s3 into your filesystem.
The reason why I would recommend against it is that s3 is not a block device while the rest of your file system is. Everything on s3 is treated as a complete object. You can't read or write to a block of the object.
If all your are doing with the mount is copying files in its entirety to and from s3, a file system mount may work reasonably well. But you can't run anything that would expect block level acccess to files on that mount.