Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Go on lambda
Search
translucens
May 28, 2018
Programming
670
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Go on lambda
Lightning talk about Go and AWS Lambda at merpay
translucens
May 28, 2018
More Decks by translucens
See All by translucens
12 Factor App on Kubernetes を12ヶ月実践して見えてきたもの
translucens
4
1.4k
The Twelve-Factor AppとKubernetes
translucens
6
1.5k
Qicoo app Frontend
translucens
0
620
Other Decks in Programming
See All in Programming
思考垂れ流し開発 ~音声入力 × AIエージェント × 開発ハーネスによる試行錯誤~
npostring
0
1.1k
PHPプロジェクトの結合バランスを可視化する #php_night
kajitack
0
240
Building an Out-of-Order CPU
latte72
1
760
iOSDC Japan 2026 - Swiftで作って学ぼう!データベース自作入門
kaseken
2
140
週末にAI-DLCを本気で回したら$1,600溶けた
hbashimizu
0
130
AIエージェント時代のコードレビューを設計する
nogu66
6
2.6k
巨大モノリシックアプリ モダン化大作戦
ktcryomm
0
930
技術的負債を組織課題として解く-増えすぎたマイクロサービスとの戦い-
reimaru
1
500
Deep dive into the select statement (GopherCon UK)
jespino
0
180
Intent as Code
shoppingjaws
6
970
フロントエンドUIフレームワークのこれまでとこれから
ssssota
5
2.5k
テストを司るデーモンに会いに行く 〜隔離した仮想マシンでテストを通すまで〜
h1d3mun3
1
190
Featured
See All Featured
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.4k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
590
What does AI have to do with Human Rights?
axbom
PRO
1
2.4k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
270
Building a Scalable Design System with Sketch
lauravandoore
464
34k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.6k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
How Software Deployment tools have changed in the past 20 years
geshan
1
34k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3k
The Spectacular Lies of Maps
axbom
PRO
1
990
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
500
Transcript
Go on AWS Lambda May 28, 2018 @merpay Soichiro Kawamura
Certain Enterprise @translucens
•$whoami • 某エンタープライズ企業 アジャイル推進部門所属 ◦ クラウドネイティブ設計、ChatOpsの布教 ◦ その前はオンプレで金融システム開発 • 道場に来た理由
◦ ドイツ拠点CTOがGoは軽量、型安全で最高!と 強く推しているので来ました ◦ ちょっとした業務改善アプリでK8sのYAMLを全部書くのはつらい →Serverlessでアプリを作りたい • 趣味 ◦ 写真、航空マイル集め、ガジェット
None
•Development over the Cloud • 「クラウドの上で」開発
•Go on Serverless platform • 型安全であり、ネイティブバイナリが生成できて 起動の速いGoはServerlessに最適 ◦ コンテナの起動に10秒以上かかる言語☕もある •
2018年になり、AWS LambdaがGoをサポート、 デプロイに使うSAMテンプレートの自動生成も可能に ◦ SAMはCloudFormationのLambda用の拡張 ◦ 他のスクリプト言語と違い、Web IDEが使えないのでSAMは必須 https://aws.amazon.com/about-aws/whats- new/2018/01/aws-lambda-supports-go/ https://aws.amazon.com/about-aws/whats- new/2018/04/aws-sam-cli-releases-new-init-command/
Preparation - sam init command $ pip install aws-sam-cli --user
$ sam init --runtime go1.x $ cd sam-app $ tree . ├── hello-world │ ├── main.go │ └── main_test.go ├── Makefile ├── README.md └── template.yaml 単にSAMのテンプレ だけでなく、 必要なコード類を 一式作ってくれる
Scaffold made by sam init AWS Lambda Lambda function Amazon
API Gateway AWS X-Ray https://checkip.amazonaws.com 2. 起動 1. GET /hello 監視 3. GET / 4. “192.0.2.1” 5. “Hello, 192.0.2.1” 6. “Hello, 192.0.2.1”
How to deploy AWS Lambda 1. $go build 2. S3バケット作成(初回のみ)
3. パッケージング(バイナリのアップロード) $sam package AWS CloudFormation 4. デプロイ $sam deploy SAM template Packaged SAM template Amazon API Gateway 自動作成
Developing Program Lambda X-Ray 監視 email SES us-west-2 (Oregon) SNS
SNS Lambda ap-northeast-1 (Tokyo) • BASE64デコード • メール→JSON変換 JSON→ SlackへのPOST
Developing Program w/ Future works Lambda email SES us-west-2 (Oregon)
EC2 SNS SNS Lambda ap-northeast-1 (Tokyo) GuardDuty Event Lambda SNS Lambda 深刻度に応じた チケット優先度の設定 ルーティング情報は SNSに集約
•Demo
•Pitfalls • 既存のS3バケットをSAMに指定できない • SESからLambdaを 直接起動する場合 ◦ 本文がJSONに含まれない ◦ 他リージョンは指定不可
• SESのテストメールが BASE64を指定しても UTF-8で送信されてBASE64デコードがこける
•Thanks JSON→Go Converter! • https://mholt.github.io/json-to-go/