ヘッダで
isBase64Encoded: True
API Gatewayで
バイナリメディアタイプに、バイナリとして扱いたいコンテンツタイプを指定する
template.yml
Resources: MyApi: Type: AWS::ApiGateway::RestApi Properties: Name: String Description: String BinaryMediaTypes: - "image/*" MyFunction: Type: AWS::Serverless::Function Properties: CodeUri: ./src Handler: index.handler Runtime: python3.6 Events: GetRoot: Type: Api Properties: RestApiId: !Ref MyApi Path: / Method: get