mirror of
https://github.com/alexgo-io/peggedassets-server.git
synced 2026-04-29 04:05:15 +08:00
move resources to files
This commit is contained in:
2
.github/workflows/deploy.yml
vendored
2
.github/workflows/deploy.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
||||
node-version: '16'
|
||||
- run: npm ci
|
||||
- name: Deploy infrastructure stack
|
||||
run: npm run deploy:prod
|
||||
run: npm run deploy:dev
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
38
resources/table-and-api.yml
Normal file
38
resources/table-and-api.yml
Normal file
@@ -0,0 +1,38 @@
|
||||
Resources:
|
||||
# DynamoDB
|
||||
DynamoTable:
|
||||
Type: AWS::DynamoDB::Table
|
||||
DeletionPolicy: Retain # Make sure the tables can't be deleted by CloudFormation/Serverless
|
||||
Properties:
|
||||
TableName: ${self:custom.tableName}
|
||||
AttributeDefinitions:
|
||||
- AttributeName: PK
|
||||
AttributeType: S
|
||||
- AttributeName: SK
|
||||
AttributeType: N
|
||||
KeySchema:
|
||||
- AttributeName: PK
|
||||
KeyType: HASH
|
||||
- AttributeName: SK
|
||||
KeyType: RANGE
|
||||
# Set the capacity to auto-scale
|
||||
BillingMode: PAY_PER_REQUEST
|
||||
# CORS for api gateway errors
|
||||
GatewayResponseDefault4XX:
|
||||
Type: 'AWS::ApiGateway::GatewayResponse'
|
||||
Properties:
|
||||
ResponseParameters:
|
||||
gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
|
||||
gatewayresponse.header.Access-Control-Allow-Headers: "'*'"
|
||||
ResponseType: DEFAULT_4XX
|
||||
RestApiId:
|
||||
Ref: 'ApiGatewayRestApi'
|
||||
GatewayResponseDefault5XX:
|
||||
Type: 'AWS::ApiGateway::GatewayResponse'
|
||||
Properties:
|
||||
ResponseParameters:
|
||||
gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
|
||||
gatewayresponse.header.Access-Control-Allow-Headers: "'*'"
|
||||
ResponseType: DEFAULT_5XX
|
||||
RestApiId:
|
||||
Ref: 'ApiGatewayRestApi'
|
||||
@@ -10,7 +10,7 @@ provider:
|
||||
memorySize: 130
|
||||
region: eu-central-1
|
||||
endpointType: REGIONAL # Set to regional because the api gateway will be behind a cloudfront distribution
|
||||
stage: prod # Default to prod if no stage is specified
|
||||
stage: dev # Default to dev if no stage is specified
|
||||
tracing: # Enable X-Ray tracing (debugging)
|
||||
apiGateway: true
|
||||
lambda: true
|
||||
@@ -147,44 +147,8 @@ functions:
|
||||
handler: src/triggerFetchCoingeckoData.default
|
||||
|
||||
resources:
|
||||
Resources:
|
||||
# DynamoDB
|
||||
DynamoTable:
|
||||
Type: AWS::DynamoDB::Table
|
||||
DeletionPolicy: Retain # Make sure the tables can't be deleted by CloudFormation/Serverless
|
||||
Properties:
|
||||
TableName: ${self:custom.tableName}
|
||||
AttributeDefinitions:
|
||||
- AttributeName: PK
|
||||
AttributeType: S
|
||||
- AttributeName: SK
|
||||
AttributeType: N
|
||||
KeySchema:
|
||||
- AttributeName: PK
|
||||
KeyType: HASH
|
||||
- AttributeName: SK
|
||||
KeyType: RANGE
|
||||
# Set the capacity to auto-scale
|
||||
BillingMode: PAY_PER_REQUEST
|
||||
# CORS for api gateway errors
|
||||
GatewayResponseDefault4XX:
|
||||
Type: 'AWS::ApiGateway::GatewayResponse'
|
||||
Properties:
|
||||
ResponseParameters:
|
||||
gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
|
||||
gatewayresponse.header.Access-Control-Allow-Headers: "'*'"
|
||||
ResponseType: DEFAULT_4XX
|
||||
RestApiId:
|
||||
Ref: 'ApiGatewayRestApi'
|
||||
GatewayResponseDefault5XX:
|
||||
Type: 'AWS::ApiGateway::GatewayResponse'
|
||||
Properties:
|
||||
ResponseParameters:
|
||||
gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
|
||||
gatewayresponse.header.Access-Control-Allow-Headers: "'*'"
|
||||
ResponseType: DEFAULT_5XX
|
||||
RestApiId:
|
||||
Ref: 'ApiGatewayRestApi'
|
||||
# DynamoDB and api gateway errors
|
||||
- ${file(resources/table-and-api.yml)}
|
||||
# Cloudfront API distribution
|
||||
- ${file(resources/api-cloudfront-distribution.yml)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user