简体   繁体   English

具有与应用相同的CNAME的S3存储桶?

[英]S3 bucket with same CNAME as app?

I have the following setup: 我有以下设置:

  • Domain registered mydomain.com 域注册了mydomain.com
  • App hosted on EC2 webserver on port 80 that's a accessible right now at mydomain.com/myapp 托管在EC2网络服务器上端口80上的应用程序,现在可通过mydomain.com/myapp进行访问
  • .csv files hosted on an S3 bucket named myapp at the following endpoint like so: s3-us-west-2.amazonaws.com/myapp/sample_file.csv 在以下端点上的名为myapp的S3存储桶上托管的.csv文件,例如: s3-us-west-2.amazonaws.com/myapp/sample_file.csv
  • Route 53 to deal with CNAME for my domain and an Elastic IP 路线53处理我的域的CNAME和一个弹性IP

Everything works fine. 一切正常。 However, now I want to update the URL's in my app to mask the longer AWS prefix and replace it instead with: mydomain.com/myapp/sample_file.csv 但是,现在我想更新我应用程序中的URL,以屏蔽更长的AWS前缀,并将其替换为: mydomain.com/myapp/sample_file.csv

Every tutorial I've seen deals with subdomains like: myapp.mydomain.com/sample_file.csv which I DON'T want (since this particular app should only be accessed at the /myapp URL) 我看过的每个教程都涉及我想要的子域,例如: myapp.mydomain.com/sample_file.csv (因为仅应通过/myapp URL访问此特定应用)

Is this possible? 这可能吗?

You could point a custom domain name to your Amazon S3 bucket. 您可以将自定义域名指向您的Amazon S3存储桶。 The basic steps are: 基本步骤是:

  • Create an Amazon S3 bucket with a name that matches your domain name (eg dl.mydomain.com ) 创建一个名称与您的域名匹配的Amazon S3存储桶(例如dl.mydomain.com
  • Activate Static Website Hosting on the bucket 在存储桶上激活静态网站托管
  • Create a Record Set in Amazon Route 53 for the dl subdomain: 在Amazon Route 53中为dl子域创建一个记录集:
    • Type A A
    • Alias = yes 别名=是
    • Select the Static website for your bucket 选择您的存储桶的静态网站

Details: Example: Setting Up a Static Website Using a Custom Domain 详细信息: 示例:使用自定义域设置静态网站

Then, put objects in the bucket within the myapp directory, eg myapp/file.csv . 然后,将对象放在myapp目录内的存储桶中,例如myapp/file.csv You will then be able to access the file via: dl.mydomain.com/myapp/file.csv 然后,您将能够通过dl.mydomain.com/myapp/file.csv访问该文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM