Last active
August 16, 2019 19:24
-
-
Save ahmetkucukoglu/918ed6445d3c1688b63aef6d59f0a131 to your computer and use it in GitHub Desktop.
serverless.yml v2
This file contains 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: ads-api | |
custom: | |
tableName: AdsTable | |
provider: | |
name: aws | |
runtime: nodejs10.x | |
region: eu-central-1 | |
profile: serverlessuser | |
apiKeys: | |
- AdsAPIKey | |
environment: | |
TABLE_NAME: ${self:custom.tableName} | |
iamRoleStatements: | |
- Effect: Allow | |
Action: | |
- dynamodb:Query | |
- dynamodb:Scan | |
- dynamodb:GetItem | |
- dynamodb:PutItem | |
- dynamodb:UpdateItem | |
- dynamodb:DeleteItem | |
Resource: | |
- "Fn::GetAtt": AdsDynamoDBTable.Arn | |
functions: | |
create: | |
handler: create.create | |
events: | |
- http: | |
path: api/ads | |
method: post | |
private: true | |
request: | |
schema: | |
application/json: ${file(create_request.json)} | |
update: | |
handler: update.update | |
events: | |
- http: | |
path: api/ads/{id} | |
method: put | |
private: true | |
request: | |
schema: | |
application/json: ${file(update_request.json)} | |
delete: | |
handler: delete.delete | |
events: | |
- http: | |
path: api/ads/{id} | |
method: delete | |
private: true | |
getAll: | |
handler: getAll.getAll | |
events: | |
- http: | |
path: api/ads | |
method: get | |
private: true | |
getById: | |
handler: getById.getById | |
events: | |
- http: | |
path: api/ads/{id} | |
method: get | |
private: true | |
resources: | |
Resources: | |
AdsDynamoDBTable: | |
Type: AWS::DynamoDB::Table | |
Properties: | |
TableName: ${self:custom.tableName} | |
ProvisionedThroughput: | |
ReadCapacityUnits: 1 | |
WriteCapacityUnits: 1 | |
AttributeDefinitions: | |
- AttributeName: id | |
AttributeType: S | |
KeySchema: | |
- AttributeName: id | |
KeyType: HASH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment