Deploying my ui artifacts to my s3 bucket

0

I have built a stack with an s3 bucket and made the bucket public and have enabled the bucket for static website hosting so that I have an endpoint to be able to spin out my project. When I run an ng build on my stack locally, it creates a dist folder with directories and files. One of the directories is a 'browser' directory that has my my index.html file in it along with other files. When i deploy my stack to AWS, it will deploy everything in the dist folder. The trouble is my the index.html file and other files are buried in the 'browser' directory so that when i try to access my bucket endpoint, it says it can't find the index.html file.
What changes do i need to make so that my index.html file is not buried in my browser directory in the dist folder or my endpoint can find the index.html file in the dist/browser directory located in my s3 bucket?

Kerry
asked 2 months ago130 views
1 Answer
2

If your index.html file is located in some folder, you can set it in the browser when you access your website Enter image description here

Or you can try a redirection rule in the S3 web hosting configuration
https://docs.aws.amazon.com/AmazonS3/latest/userguide/how-to-page-redirect.html#redirect-rule-examples

for example:

[
    {
        "Condition": {
            "KeyPrefixEquals": "index.html"
        },
        "Redirect": {
            "HttpRedirectCode": "302",
            "ReplaceKeyPrefixWith": "dist/browser/index.html"
        }
    }
]

redirection rule

profile picture
EXPERT
answered 2 months ago
profile picture
EXPERT
Artem
reviewed a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions