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