More Related Content
Similar to AWS DevDay AWS SAM을 이용한 백오피스 마이그레이션 (20)
AWS DevDay AWS SAM을 이용한 백오피스 마이그레이션
- 1. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS SAM
IaC AWS Infra
/ HBSmith
- 2. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• Why Serverless?
• How to migration to Serverless
• AWS SAM
• IaC
• Wrap up
• Q&A
- 3. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• HBSmith
• , , .
- 4. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Why Serverless?
- 5. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Why Serverless
( )
ex)
- 6. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Why Serverless
.
- 7. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Why Serverless
• .
• .
•
.
• .
App1
App2
App3
App4
- 8. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Why Serverless
EC2 ?
•
•
•
App1 App2
App3 App4
- 9. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Why Serverless
Serverless
• .
•
•
• Scale out
• Availability AWS
Lambda
- 10. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
How to migration to Serverless
Serverless ?
- 11. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
How to migration to Serverless
AWS Serverless Express
• Node Express App Lambda
• .
• AWS Lambda Amazon Linux
• API Gateway Express App
• AWS Lambda Node version
AWS
Lambda
Amazon API
Gateway
ASE
Express
- 12. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
How to migration to Serverless
Application Lambda
App1
App2
App3
App4
AWS
Lambda
Amazon API
Gateway
Amazon
Route 53
- 13. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
How to migration to Serverless
.
.
- 14. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
How to migration to Serverless
1. FrontEnd js, css Lambda .
• SPA Static Web Hosting
• S3 Lambda
Amazon
Route 53
Amazon
CloudFront
Amazon
S3
AWS
Lambda
Amazon API
Gateway
Amazon
Route 53
Amazon
S3
Amazon
CloudFront
- 15. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
How to migration to Serverless
2. Lambda RDB .
• Lambda Reserved Concurrency .
• API DB .
• RDB API .
3. .
• Lambda /tmp readonly .
• Lambda S3 .
4. API Gateway payload
• Signed url S3 .
- 16. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
How to migration to Serverless
•
•
•
• .
• .
•
• 502
• Request limit increase
app
AWS
Lambda
Amazon API
Gateway
- 17. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
How to migration to Serverless
• !
• 15
• (Cold Start)
• API Gateway
• https://docs.aws.amazon.com/ko_kr/apigateway/latest/
developerguide/limits.html
• Lambda
• https://docs.aws.amazon.com/lambda/latest/dg/limits.html
• .
• , , .
• Cost = AWS Billing - No Ops Benefits
app
AWS
Lambda
Amazon API
Gateway
- 18. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS SAM
- 19. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS SAM
Serverless frameworks
AWS SAM
(Serverless Application Model)
- 20. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS SAM
Why SAM
•
• AWS
•
•
• AWS CloudFormation
•
• Serverless
•
- 21. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SAM .
AWS SAM
- 22. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS SAM
CloudFormation .
AWS::ApiGateway::RestApi
AWS::ApiGateway::Account
AWS::ApiGateway::Resource
AWS::ApiGateway::Stage
AWS::ApiGateway::Method
AWS::ApiGateway::Authorizer
AWS::ApiGateway::Deployment
AWS::Serverless::Ap
i
CloudFormation
- 23. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS SAM
CLI
•
$ sam init —runtime python
• Local test event payload
$ sam generate-event s3 —bucket my-bucket —key test-obj.json
• AWS Lambda
$ sam local invoke test.py -e payload.json
• AWS Api Gateway & Lambda Api
$ sam local start-api
• package, deploy, logs, validate
- 24. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS SAM
CloudFormation
• template transform .
• transform: AWS::Serverless-2016-10-31
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Resources:
….
- 25. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS SAM
.
• aws-labs
• repo: https://github.com/awslabs/serverless-application-model
• CloudFormation SAM .
• slack
• https://awssamopensource.splashthat.com
- 26. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
IaC
Infrastructure as Code ?
, ,
- 27. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
IaC
IaC tool
• CloudFormation
• AWS
• AWS template
• CLI
• Terraform
• Ansible
• Chef
• Puppet
AWS
CloudFormation
- 28. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
IaC
3R
• Repeatable: .
• Reproducible: .
• Reliable: .
Server
OS
Middleware
Application
Server
OS
Middleware
Application
Server
OS
Middleware
Application
AWS AWS&IaC
Network Network Network
- 29. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
IaC
CloudFormation VPC .
Amazon
VPC
VPC NAT
gateway
Internet
gateway
router Elastic IP
address
- 30. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
IaC
SAM .
AWS
Lambda
Amazon API
Gateway
Amazon
DynamoDB
Amazon
S3
- 31. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
IaC
.
AWS
Lambda
Amazon API
Gateway
Amazon
DynamoDB
Amazon
S3
Amazon
SNS
Amazon
CloudWatch
- 32. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
IaC
SAM CI/CD .
Amazon
VPC
AWS
CodeDeploy
AWS
CodeBuild
AWS
CodePipeline
Amazon
S3
- 33. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
IaC
.
Amazon
Athena
Amazon
VPC
AWS
CodeDeploy
AWS
CodeBuild
AWS
CodePipeline
Amazon
S3
event AWS
Lambda
- 34. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
IaC
.
Amazon
VPC
AWS
CodeDeploy
AWS
CodeBuild
AWS
CodePipeline
Amazon
S3 AWS
Lambda
Amazon API
Gateway
Amazon
DynamoDB
Amazon
S3
Amazon
SNS
Amazon
CloudWatch
Amazon
Athena event
AWS
Lambda
- 35. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Wrap up
AWS Lambda .
AWS SAM Serverless resource .
AWS S3 .
Serverless RDB .
Infrastructure as Code .
- 36. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
DevOps Team
AWS Tech Partner
.
• &
• .
• 11 !
AWS .
https://hbsmith.io
HBSmith
- 37. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Q&A
• , .
• #AWSDevDay !