What is a keyName in AWS ( Amazon Web Services )?
Solution 1:
AWS S3 is, at the most basic level, just a key/value store. When you upload an object (file) to S3 you specify a unique public key for the object. In S3 the keys look like file paths, which can lead to some confusion since you don't need to do things like create subdirectories, etc. What this means, in a nutshell, is that you can upload a file using a key like /some/key/to/an/image/file.jpg
without first having to create the path /some/key/to/an/image
.
If you have static web hosting enabled for your S3 bucket then as soon as you upload file.jpg
using this key then you should be able to view it in your web browser via a URL along the lines of https://s3-eu-west-1.amazonaws.com/<bucket_name>/some/key/to/an/image/file.jpg
, depending on the region that the bucket is located in.
Solution 2:
The keyName is the "name" (=unique identifier) by which your file will be stored in the S3 bucket.
For example :
private static String uploadFileName = "c:\mydir\myfile.txt";
private static String keyName ="mydirinbucket/myfile.txt";
(N.B. You can use "/" characters to use "directories" in your S3 bucket )