Created
January 21, 2020 14:36
-
-
Save jamesbeedy/0d27b9edfaac1aa38f282a4cb36ea0c1 to your computer and use it in GitHub Desktop.
serverless.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service: | |
name: pdl-api-gui | |
app: pdl-api-gui | |
tenant: peopledatalabs | |
plugins: | |
- serverless-wsgi | |
- serverless-domain-manager | |
- serverless-python-requirements | |
- serverless-apigw-binary | |
- serverless-s3-sync | |
- serverless-plugin-resource-tagging | |
provider: | |
name: aws | |
runtime: python3.6 | |
stage: ${opt:stage, 'staging'} | |
region: us-west-2 | |
stackTags: | |
Application: ${self:service} | |
Stage: ${self:provider.stage} | |
vpc: | |
securityGroupIds: | |
- sg-78e1f104 | |
- sg-996a8be6 | |
- sg-b4e1f1c8 | |
subnetIds: | |
- subnet-62262639 | |
- subnet-495bda2f | |
- subnet-e8ef17a0 | |
environment: | |
STAGE: ${self:provider.stage} | |
functions: | |
createsuperuser: | |
handler: utils.createsuperuser.handler | |
environment: ${file(./secrets/${self:provider.stage}.yaml)} | |
makemigrations: | |
handler: utils.makemigrations.handler | |
environment: ${file(./secrets/${self:provider.stage}.yaml)} | |
migrate: | |
handler: utils.migrate.handler | |
environment: ${file(./secrets/${self:provider.stage}.yaml)} | |
pdl-api-gui: | |
handler: wsgi_handler.handler | |
environment: ${file(./secrets/${self:provider.stage}.yaml)} | |
layers: | |
- {Ref: PythonRequirementsLambdaLayer} | |
events: | |
- http: ANY / | |
- http: ANY {proxy+} | |
memorySize: 512 | |
timeout: 30 | |
package: | |
exclude: | |
- node_modules/** | |
- .tox/** | |
- .git/** | |
- '*.swp' | |
- .gitignore | |
- env/** | |
- venv/** | |
- testenv/** | |
- static/** | |
custom: | |
wsgi: | |
app: pdl_api_gui.wsgi.application | |
pythonRequirements: | |
layer: true | |
pythonBin: python3 | |
fileName: requirements/requirements.txt | |
apigwBinary: | |
types: | |
- '*/*' | |
s3Sync: | |
- bucketName: ${self:service}-${self:provider.stage}-assets | |
localDir: static | |
acl: public-read | |
customDomain: | |
domainName: ${self:functions.pdl-api-gui.environment.FQDN_BASE} | |
stage: ${self:provider.stage} | |
basePath: '' | |
certificateName: '*.peopledatalabs.com' | |
createRoute53Record: true | |
endpointType: 'regional' | |
resources: | |
Resources: | |
AssetsDistribution: | |
Type: AWS::CloudFront::Distribution | |
Properties: | |
DistributionConfig: | |
Origins: | |
- Id: Assets | |
DomainName: ${self:service}-${self:provider.stage}-assets.s3.us-west-2.amazonaws.com | |
S3OriginConfig: {} | |
DefaultCacheBehavior: | |
TargetOriginId: Assets | |
DefaultTTL: 86400 | |
MaxTTL: 31536000 | |
ViewerProtocolPolicy: redirect-to-https | |
ForwardedValues: | |
QueryString: true | |
Headers: ['Origin'] | |
Enabled: true | |
AssetsBucket: | |
Type: AWS::S3::Bucket | |
Properties: | |
BucketName: ${self:service}-${self:provider.stage}-assets | |
CorsConfiguration: | |
CorsRules: | |
- AllowedHeaders: | |
- "Authorization" | |
AllowedMethods: | |
- "GET" | |
- "HEAD" | |
- "DELETE" | |
- "PUT" | |
- "POST" | |
AllowedOrigins: | |
- "http://${self:functions.pdl-api-gui.environment.FQDN_BASE}" | |
- "https://${self:functions.pdl-api-gui.environment.FQDN_BASE}" | |
MaxAge: 3000 | |
AuroraClusterSubnetGroup: | |
Type: AWS::RDS::DBSubnetGroup | |
Properties: | |
DBSubnetGroupName: aurora-${self:service}-${self:provider.stage}-dbsg | |
DBSubnetGroupDescription: Aurora SubnetGroup | |
SubnetIds: | |
- subnet-62262639 | |
- subnet-495bda2f | |
- subnet-e8ef17a0 | |
AuroraClusterSecurityGroup: | |
Type: AWS::EC2::SecurityGroup | |
Properties: | |
GroupDescription: "Allow ingress from our vpc subnet cidrs on 3306." | |
SecurityGroupIngress: | |
- IpProtocol: tcp | |
FromPort: 3306 | |
ToPort: 3306 | |
CidrIp: 172.31.0.0/16 | |
AuroraCluster: | |
Type: AWS::RDS::DBCluster | |
Properties: | |
Engine: aurora | |
EngineMode: serverless | |
EngineVersion: '5.6' | |
DBSubnetGroupName: aurora-${self:service}-${self:provider.stage}-dbsg | |
DatabaseName: ${self:functions.pdl-api-gui.environment.DATABASE_NAME} | |
MasterUsername: ${self:functions.pdl-api-gui.environment.DATABASE_USER} | |
MasterUserPassword: ${self:functions.pdl-api-gui.environment.DATABASE_PASS} | |
Port: ${self:functions.pdl-api-gui.environment.DATABASE_PORT} | |
DBClusterIdentifier: !Ref AWS::StackName | |
BackupRetentionPeriod: 35 | |
DeletionProtection: false | |
VpcSecurityGroupIds: | |
- !GetAtt AuroraClusterSecurityGroup.GroupId |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment