{"id":894,"date":"2020-12-02T05:58:44","date_gmt":"2020-12-01T20:58:44","guid":{"rendered":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/?p=894"},"modified":"2020-12-08T15:27:57","modified_gmt":"2020-12-08T06:27:57","slug":"aws_lambda_container_image_support_jp","status":"publish","type":"post","link":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2020\/12\/02\/aws_lambda_container_image_support_jp\/","title":{"rendered":"AWS\u306e\u65b0\u6a5f\u80fd\u300cAWS Lambda Container Image Support\u300d\u3092\u7528\u3044\u3066\u3001\u30b5\u30fc\u30d0\u30fc\u30ec\u30b9\u74b0\u5883\u306e\u79fb\u884c\u3092\u691c\u8a3c\u3057\u307e\u3057\u305f"},"content":{"rendered":"
2020\u5e7411\u670830\u65e5\u304b\u3089\u958b\u50ac\u3055\u308c\u3066\u3044\u308bAWS\u306e\u30b0\u30ed\u30fc\u30d0\u30eb\u30ab\u30f3\u30d5\u30a1\u30ec\u30f3\u30b9 AWS re:Invent 2020<\/a> \u306b\u3066\u3001 \u300cAWS Lambda Container Image Support\u300d<\/a> \u3068\u3044\u3046\u65b0\u30b5\u30fc\u30d3\u30b9\u304c\u767a\u8868\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n AWS Lambda Container Image Support\u306f\u3001AWS\u306e\u30b5\u30fc\u30d0\u30fc\u30ec\u30b9\u30b3\u30f3\u30d4\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0\u300cAWS Lambda\u300d\u306b\u3066\u3001\u4eee\u60f3\u30b3\u30f3\u30c6\u30ca\u6280\u8853\u3092\u5229\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308b\u753b\u671f\u7684\u306a\u30b5\u30fc\u30d3\u30b9\u3067\u3059\u3002<\/p>\n \u4eca\u56de\u306eAWS Lambda Container Image Support\u306e\u30ea\u30ea\u30fc\u30b9\u306b\u3088\u308a\u3001AWS Lambda\u3067\u4eee\u60f3\u30b3\u30f3\u30c6\u30ca\u6280\u8853\u300cDocker\u300d\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n Docker\u30b3\u30f3\u30c6\u30ca\u30d9\u30fc\u30b9\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092AWS Lambda\u4e0a\u3067\u5b9f\u884c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308b\u3053\u3068\u3067\u3001\u3053\u308c\u307e\u3067AWS Lambda\u3067\u306f\u96e3\u3057\u304b\u3063\u305f\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9\u306b\u5bfe\u5fdc\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002\u305d\u306e\u4f8b\u3068\u3057\u3066\u306f\u6b21\u306e\u3088\u3046\u306a\u3082\u306e\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n AWS Lambda Container Image Support\u306b\u3088\u3063\u3066\u3001\u30b3\u30f3\u30c6\u30ca\u30a4\u30e1\u30fc\u30b8\u306bAWS CLI\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n \u305d\u308c\u306b\u3088\u308a\u3001AWS SDK\u3067\u306f\u7528\u610f\u3055\u308c\u3066\u3044\u306a\u3044\u300cs3 sync\u300d\u3092\u306f\u3058\u3081\u3068\u3057\u3066\u3001OS\u30e9\u30a4\u30d6\u30e9\u30ea\u3084\u7279\u5b9a\u30d1\u30c3\u30b1\u30fc\u30b8\u306b\u4f9d\u5b58\u3059\u308b\u6a5f\u80fd\u30fb\u30b3\u30de\u30f3\u30c9\u3092\u3001AWS Lambda\u3067\u3082\u5229\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n AWS Lambda Container Image Support\u3092\u7528\u3044\u308c\u3070\u3001Azure Functions\u306e\u3088\u3046\u306a\u30b3\u30f3\u30c6\u30ca\u30a4\u30e1\u30fc\u30b8\u4e0a\u3067\u7a3c\u50cd\u3059\u308b\u30b5\u30fc\u30d0\u30fc\u30ec\u30b9\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u3001AWS Lambda\u4e0a\u3067\u3082\u7a3c\u50cd\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n \u4f8b\u3048\u3070\u3001Azure Functions\u306b\u3066Web-API\u30b5\u30fc\u30d0\u30fc\u306e\u30b3\u30f3\u30c6\u30ca\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u7a3c\u50cd\u3057\u3066\u3044\u308b\u5834\u5408\u3001Proxy\u30e9\u30a4\u30d6\u30e9\u30ea\u3068API Gateway\u3092\u5229\u7528\u3057\u3066\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092AWS Lambda\u3078\u79fb\u884c\u3059\u308b\u3053\u3068\u3082\u691c\u8a0e\u3067\u304d\u307e\u3059\u3002<\/p>\n \u4eca\u56de\u306f\u3053\u306e\u30b1\u30fc\u30b9\u3092\u60f3\u5b9a\u3057\u3001Azure Functions Container Image\u3067\u7a3c\u50cd\u3059\u308b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092AWS Lambda\u306b\u79fb\u884c\u3067\u304d\u308b\u304b\u3069\u3046\u304b\u3001\u691c\u8a3c\u3092\u884c\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n \u79fb\u884c\u3059\u308b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3068\u3057\u3066\u3001\u3053\u3061\u3089\u3067\u516c\u958b\u3055\u308c\u3066\u3044\u308b\u30b7\u30f3\u30d7\u30eb\u306a\u30b3\u30fc\u30c9\u3092\u63a1\u7528\u3057\u307e\u3057\u305f\u3002<\/p>\n \u79fb\u884c\u4f5c\u696d\u306e\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\uff08\u30b7\u30b9\u30c6\u30e0\u69cb\u6210\u56f3\uff09\u306f\u6b21\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n <\/p>\n \u307e\u305a\u306f\u3001AWS Lambda Container Image Support\u3092\u52d5\u4f5c\u3055\u305b\u308b\u305f\u3081\u306b\u3001Microsoft Azure\u306e\u30b5\u30fc\u30d0\u30fc\u30ec\u30b9\u74b0\u5883\u300cAzure Functions\u300d\u3067\u7a3c\u50cd\u3057\u3066\u3044\u308bDocker\u30a4\u30e1\u30fc\u30b8\u306b\u5bfe\u3057\u3066\u3001AWS Lambda Runtime Interface Client\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3057\u305f\u3002<\/p>\n \u3053\u306e\u30b3\u30f3\u30c6\u30ca\u306bLambda\u30cf\u30f3\u30c9\u30e9\u30fc\u3092\u52a0\u3048\u3001\u30a8\u30f3\u30c8\u30ea\u30fc\u30dd\u30a4\u30f3\u30c8\u306f\u30cf\u30f3\u30c9\u30e9\u30fc\u3092\u6307\u5b9a\u3059\u308b\u3088\u3046\u306bDockerfile\u3092\u8a2d\u5b9a\u3057\u307e\u3057\u305f\u3002<\/p>\n Dockerfile\u3067\u306fAWS Lambda Runtime Client\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3057\u305f\u3002<\/p>\nAWS Lambda Container Image Support\u306e\u30e1\u30ea\u30c3\u30c8<\/h3>\n
1. \u30e9\u30a4\u30d6\u30e9\u30ea\u4f9d\u5b58\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u6d3b\u7528\u3059\u308b<\/h4>\n
2. \u4ed6\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u306e\u30b5\u30fc\u30d0\u30fc\u30ec\u30b9\u74b0\u5883\u3092AWS Lambda\u3078\u79fb\u884c\u3059\u308b<\/h4>\n
Azure Functions\u304b\u3089AWS Lambda\u3078\u306e\u79fb\u884c\u306e\u691c\u8a3c<\/h3>\n
\u5b9f\u65bd\u3057\u305f\u4f5c\u696d<\/h4>\n
Dockerfile\u306e\u8a2d\u5b9a\u4f8b\uff1a<\/h4>\n
# Azure Functions Container\nFROM xblood\/azurefunctionsimage:v1.0.0\n\nARG FUNCTION_DIR="\/home\/app\/"\nARG RUNTIME_VERSION\nARG DISTRO_VERSION\n\nRUN apt-get install -y libtool autoconf automake make cmake\n# build-base, libexecinfo-dev, libcurl\nRUN apt-get install -y curl build-essential\nRUN pip install awscli\nARG AWS_ACCESS_KEY_ID\nARG AWS_SECRET_ACCESS_KEY\nARG AWS_SESSION_TOKEN\nENV AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}\nENV AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}\nRUN mkdir -p ${FUNCTION_DIR}\n\n# Copy Lambda Handler\nCOPY handler.py ${FUNCTION_DIR}\n\n# Install AWS Lambda Runtime Interface Client\nRUN python${RUNTIME_VERSION} -m pip install \\\n awslambdaric \\\n --target \/home\/app\/\n\nWORKDIR ${FUNCTION_DIR}\n\n# Set the CMD to handler\nENTRYPOINT [ "\/usr\/local\/bin\/python", "-m", "awslambdaruntimeclient" ]\nCMD [ "handler.lambda_handler" ]<\/code><\/pre>\n