How can I access any files in Amazon EBS through URI? - amazon-ec2

I have a question about the direct way to access file in EBS.
If I have an EC2 and EBS already and have a file 'a.pdf', can I access 'a.pdf' through URI? even out of EC2?
for example, my friend Mike wants to get 'a.pdf' file at his house just using Web browser or teminal program, etc. Please tell me what action does Mike have to do!
Thanks!

If you have an EC2 instance running you can set up a web server on your EC2 instance, mount the EBS volume and access the file via the web server.
AFAIK there is no way to access files in EBS directly - if this is what you need you should be using S3.

Related

Need a way to mount or share s3 or any other aws storage service in windows ec2 instance

We have use case where we want the ability to create shareable drive that would link our ec2 windows instance with any of the storage service (s3 or any other service), such that our user would upload their pdf files in that storage and will be accessible by our windows ec2 instance in which we have program that does pdf files processing. So is there way we can achieve this in aws?
Since your Windows software requires a 'local drive' to detect input files, you could mount an Amazon S3 bucket using utilities such as:
Cloudberry Drive
TntDrive
Mountain Duck
ExpanDrive
Your web application would still be responsible for authenticating users and Uploading objects using presigned URLs - Amazon Simple Storage Service directly to Amazon S3. Your app would also need to determine how to handle the 'output' files so that users can access their converted file.

How to share file in Windows Amazon EC2 instance

I am using an Amazon EC2 instance running Windows.
How can I share a file to external users that are not in the same network but they have internet access? If there is an option by doing it programmatically, it will be very useful.
Thank you.
Your situation is not specific to Amazon EC2. The answer would be applicable to any Windows computer on the Internet.
The easiest way for a computer to "share a file to external users" would be via a web server. Users could simply click a link in the web browser and the file would download.
However, since you are running on AWS, you might want to take advantage of Amazon S3, which is a an object storage service. You could upload the file from the Windows computer to Amazon S3 and then make the file publicly available via a URL. This way, your users will be able to access the file without having to connect to the Windows computer. It would also be more reliable and could handle more traffic than the Windows computer. You can programmatically upload to an Amazon S3 bucket.

nfs issue on AWS Amazon Linux2

I'm running multiple websites on Amazon AWS. I mounted and EBS on the master server, the mount dir hold the website's files.
Also, I configured the application load balancer, which installs small instances when there is a load on the master. The clone servers running NFS clients to connect to the master server and mount the website's files.
Everything works perfectly, but the issue many times the clones server cannot mount the NFS server even when I try to mount manually. I have to run exportfs -f to flush the NFS table on the master instance.
I do not know why this happens. If you need any further information just give the CMD for it.
As I understand You are trying to mount the EBS from multiple ec2 instances.
This can be done using the multi-attach capability of EBS. However the are some limitations to this capability (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volumes-multi.html). So, in short, if You have more than 16 instanced trying to mount to this EBS, you hit the limit.
My suggestion to solve that - Use EFS instead. EFS is an elastic file system managed service by AWS. Really simple to use, can be mounted from multiple Linux instances and elastic (so you pay-as-you-grow). Check it here: https://docs.aws.amazon.com/efs/latest/ug/mount-multiple-ec2-instances.html

File permission in Linux, Allowing user upload in Amazon ec2

I am making a web app that is hosted on amazon ec2. One of the page allows user to upload photo to the site.
MY script works on ordinary site, but not with ec2, so I suspect the problem is about connection or authorization.
Maybe ordinary web user do not have authorization to upload to the var/www/html/ directory? But how to enable them?
(specifically I think the following line is not working
move_uploaded_file)
I am using AMazon ec2 micro instance Linux AMI server. I am uploading via a form in a php file.

How do I publicly host a file on my Amazon EC2 instance?

Though similar to Amazon EC2 How Do I Host a PDF File on my Instance? this is not a simple case of case sensitivity.
I currently have the file I'd like to be publicly available in /var/www/html which is the DocumentRoot (though note we've also got amazon EBS set up) but nonetheless going to ourinstance/file.pdf gives 404 not found.
I'd like to avoid having to use S3.
You need to setup a web server (apache/nginx) and configure it to serve the file (from a domain). In order to do that, you need to setup a virtual host (or its equivalent in nginx).
Once done, you start the server and assuming DNS settings are correctly setup, your file should be served.
I think this question is better suited to be asked on serverfault rather than stackoverflow.

Resources