Name ӂ (MinJae Kwon) Nickname @mingrammer Email [email protected] Who Game Server Engineer @ SundayToz Blog https://mingrammer.com Facebook https://facebook.com/mingrammer Github https://github.com/mingrammer Eng Blog https://medium.com/@mingrammer
Serverless? Dist EC2 EC2 Cache Dist EC2 EC2 Cache Client Client API Code API Code By Server Engineers By AWS have to manage entire architectures and logics focus on logics
Building a service with AWS AWS Lambda handler def lambda_handler(event, context) Check existence of a resized image Get a resized image Put a resized image Resize an image Generate an thumbnail link Amazon S3 resizer code
Building a service with AWS Amazon API Gateway AWS Lambda handler def lambda_handler(event, context) Check existence of a resized image Get a resized image Put a resized image Resize an image Generate an thumbnail link Amazon S3 resizer code
Building a service with AWS Write Lambda handler function def lambda_handler(event, context): sub = event.get('sub') category = event.get('category') filename = event.get('filename') width = event.get('width') # Check if the image url with given parameter exists # If the format of image is not supported, redirect to original image with Image(file=original_image['Body']) as img: # If width is not set, get width of original image # Check if the width is valid numeric value # If the thumbnail already exists, redirect to that # Image resizing ] event.get('field') ?
Building a service with AWS Write Lambda handler function ../{sub}/{category}/{filename}?width=400 Amazon API Gateway AWS Lambda API Gateway Mapping Templateীࢲ Lambda۽ ۄఠܳ ֈѹષ
Building a service with AWS Write Lambda handler function event.get('field') Amazon API Gateway AWS Lambda Amazon S3 Valid? Format check Param check Amazon S3 Exists? Resize Save Amazon S3 original thumbnail Get object Get object Put object
Building a service with AWS Set up API Gateway with Lambda /mingrammer/{sub}/{category}/{filename}ۄח ߡఉ ೞਤ ҃۽ ӏী ݏѱ ܻࣗझܳ ࢤࢿ ҃۽ ܳ Object ఃчਵ۽ ࢸ೧ S3۽ Ӕҗ زੌೠ Ӕ ߑधਸ ஂೞӝ ਤೣ ( {variable} ҃۽ ߸ࣻܳ ڷೣ )
Building a service with AWS Set up API Gateway with Lambda {/filenamae} ҃۽ীࢲ ݫࢲ٘ ࢤࢿਸ ࢶఖೠ റ GET ݫࢲ٘ܳ ࢤࢿ /mingrammer/{sub}/{category}/{filename} ҃۽ী ೧ API ݫࢲ٘ܳ ೡ ࣻ
Building a service with AWS Set up API Gateway with Lambda ҃۽ ߸ࣻܳ ࢸ೮ীب Noneۄח ч ٜযоҊ API Gatewayীࢲ Lambda۽ context ৻ ୶оੋ ۄఠܳ ׳ೞӝ ਤ೧ࢶ Mapping Templatesܳ ࢸ೧ঠೣ Lambda۽ সਸ ਃೞӝ API Gatewayী ٜযয়Ѣա ઓೞח ߸ٜࣻਸ JSON ഋక۽ ݒೝೞৈ ׳