I've set up an API Gateway using the base example (Pets) in AWS.
On around 5 out of 12 AWS Windows Workspaces that various dev's use, I get a forbidden response. I've been told by the person who set up the environments around 6 months ago that they were all setup using the same base image and permissions.
Is there something someone can do on their workspace that could make a Powershell Invoke-RestMethod call to return a 403? This code also works on my actual laptop, and even on my personal home machine, which suggests it isn't an API Gateway issue, but happy to be proved wrong. Nothing seems to appear in Cloudwatch when this failure happens.
$apiUrl="https://blahblah.execute-api.eu-west-1.amazonaws.com/Test/pets";
Invoke-RestMethod $apiUrl -Method Get -ContentType 'application/json'
Invoke-RestMethod : {"message":"Forbidden"} At line:1 char:1
- Invoke-RestMethod $apiUrl -Method Get -ContentType 'application/json'
-
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc eption + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
I have another AWS Lambda using Function Url, that seems to work fine everywhere (so far).