2016-10-28 3 views
1

추가하기 :AWS API 게이트웨이 및 운동성 파이어 호스 통합 :위한 추가적인 데이터 나는 현재 AWS 운동성 파이어 호스 스트림에 AWS API 게이트웨이 엔드 포인트에 송신 데이터를 전달하기 위해 다음과 같은 매핑 템플릿을 사용하고

{ 
    "DeliveryStreamName": "[STREAMNAME]", 
    "Record": { 
     "Data": "$util.base64Encode($input.body)" 
    } 
} 

내가 싶은 것이 요청을하는 클라이언트의 $context.identity.sourceIp처럼 인코딩되는 $input.body에 정보를 추가하십시오.

Kinesis Firehose로 전달되는 출력을 Base64 인코딩해야 할 때 어떻게해야합니까?

#set($inputRoot = $input.path('$')) 
#set($data = "{ 
    #foreach($key in $inputRoot.keySet()) 
    ""$key"": $input.json($key), 
    #end 
    ""clientIP"": ""$context.identity.sourceIp"", 
}") 
{ 
    "DeliveryStreamName": "[STREAMNAME]", 
    "Record": { 
     "Data": "$util.base64Encode($data)" 
    } 
} 

내가 알고하지 않았다 : 나는이 일을 다음 얻을 관리 조금 더 파고 후

{ 
    "x": 1, 
    "y": 2, 
    "z": 3, 
    ...,     // all the properties from the JSON-request by the client 
    "clientIp": "x.x.x.x" // property added by API-Gateway into client's object 
} 

답변

4

: 이상적으로는 운동성 파이어 호스에 게시되고 내 데이터는 다음과 같이 싶습니다 #set 안에 #foreach를 수행 할 수 있습니다. 이 권한을 얻으려면 큰 따옴표를 사용해야합니다.

관련 문제