What is keyName in AWS (Amazon Web Services)?

So, I started to learn the loading mechanism using AWS. Also, while watching a few other examples, I noticed that in fact I am not getting a single thing (although I read the documentation again and again, in these specific parts). When you create an AWS account, you are provided with a key. But there is also the concept of ObjectKey.

So, given this example: http://docs.aws.amazon.com/AmazonS3/latest/dev/UploadObjSingleOpJava.html

especially this piece of code:

private static String bucketName = "*** Provide bucket name ***"; private static String keyName = "*** Provide key ***"; private static String uploadFileName = "*** Provide file name ***"; 

I have to ask: what does this keyName represent? Is it the name of the object (the name that will be found in the bucket), or is it the secret key specified when creating the account?

+5
source share
3 answers

AWS S3 at its most basic level is just a key / value store . When you upload an object (file) to S3, you specify a unique public key for the object. In S3, 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 having to create the path /some/key/to/an/image .

If you have enabled static web hosting for your S3 bucket, then as soon as you download file.jpg with this key, you can view it in your web browser at the URL in the line https://s3-eu-west-1.amazonaws.com/<bucket_name>/some/key/to/an/image/file.jpg , depending on the area in which the bucket is located.

+6
source

The key name is the "name" (= unique identifier) ​​by which your file will be stored in the S3 bucket.

For instance:

  private static String uploadFileName = "c:\mydir\myfile.txt"; private static String keyName ="mydirinbucket/myfile.txt"; 

(NB You can use the "/" characters to use the "directories" in your S3 bucket)

+2
source

In AWS, here is staging_path= "devel" and key = "/"+staging_path.

0
source

Source: https://habr.com/ru/post/1232460/


All Articles