How to access Amplify Hosting Rewrite & Redirect rules via AWS Cli

0

Is there a way I can use AWS Cli to access the Amplify Hosting and Rewrite rules? I would like to grab the list and re-sequence the rules.

The problem is that when a Preview Environment is spun up, they add a cloudfront rule on the top which over rides my custom rules. Or if there's a way during the post-build process from the amplify.yml to push the auto generated cloudfront rewrite rules to the bottom of the rewrite rules would work as well.

질문됨 일 년 전355회 조회
1개 답변
0

Yes, you can use the AWS CLI to access the Amplify Hosting and Rewrite rules using the get-app CLI command. Please refer the below document for the same.

[+] https://awscli.amazonaws.com/v2/documentation/api/2.1.30/reference/amplify/get-app.html

In order to change or re-sequence your rules, you can re-sequence the rules directly in the Rewrites and redirects page in your Amplify App settings.

If you want to change or re-sequence the rules through AWS CLI you would need to write all the re-sequenced rules once again. You can refer the below document for updating the rewrites and redirects rules through the AWS CLI.

[+] https://awscli.amazonaws.com/v2/documentation/api/2.1.30/reference/amplify/update-app.html

Regarding the CloudFront rule, I believe that you are using a Next.js SSR app as the CloudFront rule is getting added at the top. So, the CloudFront rules which are created is an expected behaviour and this shouldn't affect the Next.js app. But, incase if you have any app related issue with this behaviour you can reach out to us.

AWS
Srinath
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠