From the AWS docs, I understand that:
- S3 key names can be any UNICODE name < 1024 chars
- When using the GET OBJ, I need to URL encode the key name to access it.
However, these rules seem too permissive.
For instance, if I make a key called '../../d', a 400 ERROR occurs when I attempt to access it with the GET OBJECT API. Interestingly, I have no problem accessing '../d'.
Is there a document specifying what is and is not legal?
The only restrictions provided by Amazon is (as found on their Technical FAQ):
Additional restrictions apply for Buckets (as found on the Rules for Bucket Naming section of their Bucket Restrictions and Limitations FAQ):
Less permissive restrictions apply to the US standard region. Please see the FAQs for additional information and some examples. Hope it helps!
According to AWS S3 documentation:
Please find below the
Object Key Naming Guidelines from the AWS S3 official documentation
Safe characters
The following character sets are generally safe for use in key names:
NOTE ABOUT THE DELIMITER ("/")
The following are examples of valid object key names:
4my-organization
my.great_photos-2014/jan/myvacation.jpg
videos/2014/birthday/video1.wmv
Note that the Amazon S3 data model is a flat structure: you create a bucket, and the bucket stores objects. There is no hierarchy of subbuckets or subfolders; however, you can infer logical hierarchy using keyname prefixes and delimiters as the Amazon S3 console does.
e.g if you use Private/taxdocument.pdf as a key, it will create the Private folder, with taxdocument.pdf in it.
Characters That Might Require Special Handling
The following characters in a key name may require additional code handling and will likely need to be URL encoded or referenced as HEX. Some of these are non-printable characters and your browser may not handle them, which will also require special handling:
Characters to Avoid
You should avoid the following characters in a key name because of significant special handling for consistency across all applications.