Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
AWS Lambdaを画像変化サーバとして使おうとした話 / AWS Lambda
Search
Kuranari Tomohisa
September 30, 2015
Programming
0
1.3k
AWS Lambdaを画像変化サーバとして使おうとした話 / AWS Lambda
Geeks Night @Money Forward
Kuranari Tomohisa
September 30, 2015
Tweet
Share
More Decks by Kuranari Tomohisa
See All by Kuranari Tomohisa
英語学習用CLIツールを作った話
kuranari
0
290
21Cafe感謝祭 / 21Cafe
kuranari
0
68
MUGEN MEET UP #1
kuranari
0
65
MUGEN MEET UP #0
kuranari
0
190
Clipboard API
kuranari
0
280
Other Decks in Programming
See All in Programming
CSC509 Lecture 09
javiergs
PRO
0
140
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
170
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
130
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.2k
Duckdb-Wasmでローカルダッシュボードを作ってみた
nkforwork
0
130
ペアーズにおけるAmazon Bedrockを⽤いた障害対応⽀援 ⽣成AIツールの導⼊事例 @ 20241115配信AWSウェビナー登壇
fukubaka0825
6
2k
Generative AI Use Cases JP (略称:GenU)奮闘記
hideg
1
300
Less waste, more joy, and a lot more green: How Quarkus makes Java better
hollycummins
0
100
A Journey of Contribution and Collaboration in Open Source
ivargrimstad
0
970
GitHub Actionsのキャッシュと手を挙げることの大切さとそれに必要なこと
satoshi256kbyte
5
430
Tauriでネイティブアプリを作りたい
tsucchinoko
0
370
Outline View in SwiftUI
1024jp
1
330
Featured
See All Featured
How to train your dragon (web standard)
notwaldorf
88
5.7k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Documentation Writing (for coders)
carmenintech
65
4.4k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
The Cult of Friendly URLs
andyhume
78
6k
A Tale of Four Properties
chriscoyier
156
23k
Teambox: Starting and Learning
jrom
133
8.8k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
Building Adaptive Systems
keathley
38
2.3k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
Transcript
"84-BNCEBΛ ը૾มαʔόͱͯ͠ ͓͏ͱͨ͠ ஐٱ !LVSBOBSJ@UN (FFLT/JHIU!.POFZ'PSXBSE
ࣗݾհ w ஐٱ !LVSBOBSJ@UN w גࣜձࣾ.6(&/61ΤϯδχΞ w 3BJMTΛத৺ʹ৭ʑͱ
.6(&/61 w %Πϥετɾ%$(ͷΫϥυιʔγϯά
.6(&/61 w %Πϥετɾ%$(ͷΫϥυιʔγϯά w </FX>σβΠϯ੍࡞ͷϓϩδΣΫτཧπʔϧ
w ΫϥυܕϓϩδΣΫτཧπʔϧ w ήʔϜΞηοτ੍࡞ʹศརͳػೳ͕ͨ͘͞Μ IUUQXXXTBWFQUDPN
ϑΝΠϧϓϨϏϡʔ 14%"*ϑΝΠϧ͔ΒαϜωΠϧΛ࡞
"84-BNCEBΛͬͯ ߏͯ͠Έͨ
"84-BNCEBͷಛ w ΠϕϯτΛτϦΨʔʹίʔυΛ࣮ߦͰ͖Δ w ྫ 4ϑΝΠϧ͕Ξοϓϩʔυ͞Εͨ࣌ w ίʔυ࣮ߦ͚࣌ؒͩ՝ۚ ແྉ༻ॆ
w ࣗಈεέʔϦϯά w ݴޠ/PEFKT +BWB
"84-BNCEBΛͬͨߏ 3BJMT͔Β4ʹϑΝΠϧΛ Ξοϓϩʔυ -BNCEB͕࣮ؔߦ * 4͔Β-BNCEBʹ14% ϑΝΠϧಡΈࠐΈ **
14%ˠ+1(ม *** +1(Λ4ʹΞοϓ 4 &$ 3BJMT -BNCEB OPEFKT
MBNCEBؔ var async = require('async'); var AWS
= require('aws-‐sdk'); var gm = require('gm').subClass({ imageMagick: true }); var s3 = new AWS.S3(); exports.handler = function(event, context) { var srcBucket = event.Records[0].s3.bucket.name; var srcKey = decodeURIComponent(event.Records[0].s3.object.key); var dstBucket = srcBucket + "resized"; var dstKey = "resized-‐" + srcKey.replace(/\..*$/, ".jpg"); async.waterfall([ function download(next) { s3.getObject({ Bucket: srcBucket, Key: srcKey }, next); }, function transform(response, next) { gm(response.Body).toBuffer("jpg", function(err, buffer) { next(null, response.ContentType, buffer); }); }, function upload(contentType, data, next) { s3.putObject({ Bucket: dstBucket, Key: dstKey, ɹɹɹɹɹɹɹɹɹɹɹ Body: data, ContentType: contentType }, next); }], function (err) { context.done(); }); }; ࢀߟIUUQEPDTBXTBNB[PODPNKB@KQMBNCEBMBUFTUEHXBMLUISPVHITFWFOUTBENJOVTFSIUNM
MBNCEBؔ var async = require('async'); var AWS
= require('aws-‐sdk'); var gm = require('gm').subClass({ imageMagick: true }); var s3 = new AWS.S3(); exports.handler = function(event, context) { var srcBucket = event.Records[0].s3.bucket.name; var srcKey = decodeURIComponent(event.Records[0].s3.object.key); var dstBucket = srcBucket + "resized"; var dstKey = "resized-‐" + srcKey.replace(/\..*$/, ".jpg"); async.waterfall([ function download(next) { s3.getObject({ Bucket: srcBucket, Key: srcKey }, next); }, function transform(response, next) { gm(response.Body).toBuffer("jpg", function(err, buffer) { next(null, response.ContentType, buffer); }); }, function upload(contentType, data, next) { s3.putObject({ Bucket: dstBucket, Key: dstKey, ɹɹɹɹɹɹɹɹɹɹɹ Body: data, ContentType: contentType }, next); }], function (err) { context.done(); }); }; ϥΠϒϥϦϩʔυ ࢀߟIUUQEPDTBXTBNB[PODPNKB@KQMBNCEBMBUFTUEHXBMLUISPVHITFWFOUTBENJOVTFSIUNM
MBNCEBؔ var async = require('async'); var AWS
= require('aws-‐sdk'); var gm = require('gm').subClass({ imageMagick: true }); var s3 = new AWS.S3(); exports.handler = function(event, context) { var srcBucket = event.Records[0].s3.bucket.name; var srcKey = decodeURIComponent(event.Records[0].s3.object.key); var dstBucket = srcBucket + "resized"; var dstKey = "resized-‐" + srcKey.replace(/\..*$/, ".jpg"); async.waterfall([ function download(next) { s3.getObject({ Bucket: srcBucket, Key: srcKey }, next); }, function transform(response, next) { gm(response.Body).toBuffer("jpg", function(err, buffer) { next(null, response.ContentType, buffer); }); }, function upload(contentType, data, next) { s3.putObject({ Bucket: dstBucket, Key: dstKey, ɹɹɹɹɹɹɹɹɹɹɹ Body: data, ContentType: contentType }, next); }], function (err) { context.done(); }); }; ϥΠϒϥϦϩʔυ όέοτ ϑΝΠϧ໊ఆٛ ࢀߟIUUQEPDTBXTBNB[PODPNKB@KQMBNCEBMBUFTUEHXBMLUISPVHITFWFOUTBENJOVTFSIUNM
MBNCEBؔ var async = require('async'); var AWS
= require('aws-‐sdk'); var gm = require('gm').subClass({ imageMagick: true }); var s3 = new AWS.S3(); exports.handler = function(event, context) { var srcBucket = event.Records[0].s3.bucket.name; var srcKey = decodeURIComponent(event.Records[0].s3.object.key); var dstBucket = srcBucket + "resized"; var dstKey = "resized-‐" + srcKey.replace(/\..*$/, ".jpg"); async.waterfall([ function download(next) { s3.getObject({ Bucket: srcBucket, Key: srcKey }, next); }, function transform(response, next) { gm(response.Body).toBuffer("jpg", function(err, buffer) { next(null, response.ContentType, buffer); }); }, function upload(contentType, data, next) { s3.putObject({ Bucket: dstBucket, Key: dstKey, ɹɹɹɹɹɹɹɹɹɹɹ Body: data, ContentType: contentType }, next); }], function (err) { context.done(); }); }; ϥΠϒϥϦϩʔυ όέοτ ϑΝΠϧ໊ఆٛ αϜω࡞ ࢀߟIUUQEPDTBXTBNB[PODPNKB@KQMBNCEBMBUFTUEHXBMLUISPVHITFWFOUTBENJOVTFSIUNM
ઃఆύϥϝʔλ w ΠϕϯττϦΨ 4 %ZOBNP%# FUD w λΠϜΞτ࣌ؒ dඵ
w ϝϞϦྔ d .#
(#͑ͷ14%Λ ϝϞϦ .# ॲཧ࣌ؒඵ Ͱ͚͞Δͷʁ
ݕূ
ϝϞϦ(# λΠϜΞτ࣌ؒඵͰ ॲཧ͖͠ΕΔͷ͔ʜʁ 14% ϑΝΠϧαΠζ ࣮ߦ࣌ؒ ϝϞϦ༻ྔ .# ඵ .#
.# ඵ .# .# ඵ .# .# &SSPS .# .# &SSPS .# ϝϞϦΛ͍͖ͬͯࢮΜͰΔʁ
݁Ռ w "84-BNCEBΛΘͳ͍ํ๏Λ࠾༻ͨ͠ w (#ΫϥεͷϑΝΠϧΛѻ͏߹੍͕Ωπ͍ w ॏ͍όονॲཧΛஔ͖͑ΔͷͰͳ͍Έ͍ͨ