I'm new to using AWS S3. I need to host my privacy policy HTML page and T&C HTML page in the S3 bucket as static web pages. I need separate URLs for those two files but I can not create separate S3 buckets for each file. So is there any way to full fill my requirement?
I need this kind of URLs after hosting the pages in the S3 bucket
http://<bucket-name>.s3-website-<AWS-region>.amazonaws.com/privacypolicy.html
http://<bucket-name>.s3-website-<AWS-region>.amazonaws.com/termsandcondition.html
also, I can not create an index file for these HTML pages and after that link these HTML pages to that index file, because I need these URLs to link my mobile app. once the user clicks one of the links, the user should go to that page so that's why I need separate URL for these files.
CodePudding user response:
You dont have to create separate bucket
Just create 2 HTML files for example site1.html and site2.html. Here are the steps to follow
- upload site1.html and site2.html
- enable website hosting and enter site1.html instead of index.html
- turn off block public access setting
- add bucket policy to access bucket publicly https://docs.aws.amazon.com/AmazonS3/latest/userguide/WebsiteAccessPermissionsReqd.html
- access website using website hosting URL link, this will lead to site1.html, if you want to access site2.html just append site2.html to root address
for example here is my link for site1.html http://stack-trial.s3-website.ap-south-1.amazonaws.com/
Note: you can also access the site1.html using this http://stack-trial.s3-website.ap-south-1.amazonaws.com/site1.html.
for site2.html http://stack-trial.s3-website.ap-south-1.amazonaws.com/site2.html