Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Go on lambda
Search
translucens
May 28, 2018
Programming
2
630
Go on lambda
Lightning talk about Go and AWS Lambda at merpay
translucens
May 28, 2018
Tweet
Share
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.4k
Qicoo app Frontend
translucens
0
560
Other Decks in Programming
See All in Programming
Python札幌 LT資料
t3tra
6
980
マスタデータ問題、マイクロサービスでどう解くか
kts
0
110
gunshi
kazupon
1
100
AIエンジニアリングのご紹介 / Introduction to AI Engineering
rkaga
8
3.2k
まだ間に合う!Claude Code元年をふりかえる
nogu66
5
870
DevFest Android in Korea 2025 - 개발자 커뮤니티를 통해 얻는 가치
wisemuji
0
160
チームをチームにするEM
hitode909
0
350
AIエージェントの設計で注意するべきポイント6選
har1101
5
1.6k
Cell-Based Architecture
larchanjo
0
140
リリース時」テストから「デイリー実行」へ!開発マネージャが取り組んだ、レガシー自動テストのモダン化戦略
goataka
0
130
tsgolintはいかにしてtypescript-goの非公開APIを呼び出しているのか
syumai
7
2.3k
ローカルLLMを⽤いてコード補完を⾏う VSCode拡張機能を作ってみた
nearme_tech
PRO
0
120
Featured
See All Featured
Leadership Guide Workshop - DevTernity 2021
reverentgeek
0
160
Rails Girls Zürich Keynote
gr2m
95
14k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5k
How to Think Like a Performance Engineer
csswizardry
28
2.4k
Applied NLP in the Age of Generative AI
inesmontani
PRO
3
1.9k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
1
200
The SEO Collaboration Effect
kristinabergwall1
0
300
Odyssey Design
rkendrick25
PRO
0
430
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
12
Marketing to machines
jonoalderson
1
4.3k
How to train your dragon (web standard)
notwaldorf
97
6.4k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.8k
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/