Fixed: Amplify AWS Access Denied

This article will examine a solution to the AWS Amplify Access Denied issue. We can resolve your AWS Amplify issues at Skynats using our AWS Support Services.

What Causes the Error “AWS Amplify Access Denied”?

Through the use of a set of tools and features collectively referred to as AWS Amplify, frontend web and mobile developers can build full-stack applications on AWS. They have the discretion to choose from a variety of AWS services as their use cases evolve.

Amplify allows users to connect their apps in minutes, configure a web or mobile app backend, and visually build a web frontend UI while managing app content outside of the AWS console. Deliver faster and scale with no need for cloud expertise.

However, when using AWS Amplify, we might encounter the “Access Denied” error. The “Access Denied” error in AWS Amplify can appear for several reasons. Let’s look at a few of them and their solutions.

Case 1

If the app’s distribution directory is improperly configured, we might encounter an error when deploying and hosting the app with Amplify.

Solution:

To fix it, change the distribution directory using the amplify configure project tool, and then restart amplify publish.

Case 2

When the root directory of the website cannot initialize properly, the “Access Denied” error is displayed.

<Error>
  <Code>AccessDenied</Code>
  <Message>Access Denied</Message>
  <RequestId>4442587FB7D0A2F9</RequestId>
  <HostId>...</HostId>
</Error>

Solution:

Ensure that when manually deploying an application from Amazon S3, the zip folder contains the build output instead of the top-level folder. For instance, if the build output creates a folder with the names “build” or “public,” go into that folder, select everything inside, and zip it up.

Case 3

One can access the first landing page after the angular app has been deployed on AWS Amplify. The Access Denied error would appear when we attempted to access a path that was defined on the router.

Solution:

  • Start by visiting the AWS console.
  • Choose “Rewrites and redirects.”
  • After that, make a fresh rewrite and redirect the rule.
  • Enter the following rule after clicking “Open text editor”:
[
    {
        "source": "</^[^.]+$|\\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|ttf)$)([^.]+$)/>",
        "target": "/index.html",
        "status": "200",
        "condition": null
    }
]

At this point, we can successfully access the URL.

Conclusion

In this article, we looked at a few situations where we might run into the AWS Amplify “Access Denied” error. Additionally, we offered the most effective fixes from our Tech Support team in each situation. Contact us.

Liked!! Share the post.

Share on facebook
Share on twitter
Share on linkedin
Share on reddit

FREE SERVER AUDITING

Get Auditing Report of Your Server for FREE!!

GET THIS ISSUE FIXED !!

$30/month

Server Management