I need to provide some sort of REST API backed by a S3 bucket. The requirement is simple: given a certain key, it should return the contents of the file whose name is that key. If no such file is found in the bucket, then return a default content. In both cases, the response status code should be 200, because the client should not care where the result came from.
This requirement is so simple that I was trying to accomplish this without writing any code. So I tried to put an API created by Amazon API Gateway in front of the S3 bucket. But even though in the "Integration Response" section you can map a "HTTP status regex" to a "Method response status", apparently the same "Method response status" can't appear twice. So, I cannot have a default mapping to 200 while mapping 404 responses also to 200 with a custom body mapping template.
Is it possible to do this using only API Gateway?
If the only thing limiting you is number of available responses you can use 203 (forwarding content from the origin) as another successful response. Or you can write a simple lambda function behind your API Gateway to craft the response.