Skip to content

Instantly share code, notes, and snippets.

@dehio3
Last active July 11, 2020 03:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dehio3/068ad6c72252c770ba573944ab441a3c to your computer and use it in GitHub Desktop.
Save dehio3/068ad6c72252c770ba573944ab441a3c to your computer and use it in GitHub Desktop.
カスタムドメインを利用したAPI Gatewayとlambda環境構成のサンプル
service:
name: ${self:custom.serviceName}
provider:
name: aws
apiName: ${self:custom.serviceName}-API
endpointType: REGIONAL
apiKeys:
- ${self:custom.serviceName}
runtime: python3.7
memorySize: 128
timeout: 3
logRetentionInDays: 30
stage: ${env:STAGE, self:custom.defaultStage}
region: ${env:AWS_DEFAULT_REGION, self:custom.defaultRegion}
functions:
sample:
handler: src/lambda_function.lambda_handler
name: ${self:custom.serviceName}
description: Managed by Serverless Framework
events:
- http:
path: /calcAmount
method: get
private: true
integration: lambda-proxy
package:
exclude:
- '**'
include:
- 'src/**'
plugins:
- serverless-python-requirements
- serverless-pseudo-parameters
- serverless-domain-manager
custom:
serviceName: sample
defaultStage: dev
defaultRegion: ap-northeast-1
domainName:
dev: <development domain name>
prod: <production domain name>
certificateArn:
dev: arn:aws:acm:ap-northeast-1:<development acount id>:certificate/***************************
prod: arn:aws:acm:ap-northeast-1:<production acount id>:certificate/***************************
# serverless-python-requirements plugin
pythonRequirements:
usePipenv: true
# serverless-domain-manager plugin
customDomain:
domainName: ${self:custom.domainName.${self:provider.stage}}
stage: ${self:provider.stage}
basePath: ''
createRoute53Record: true
certificateArn: ${self:custom.certificateArn.${self:provider.stage}}
endpointType: 'regional'
securityPolicy: tls_1_2
apiType: rest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment