Last active
January 11, 2020 00:38
-
-
Save djheru/68fe8e2257af9a88760a9fb3efbd5c3c to your computer and use it in GitHub Desktop.
26_serverless.yml
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: you-betta-rekognize | |
package: | |
individually: true | |
plugins: | |
- serverless-bundle | |
- serverless-pseudo-parameters | |
custom: | |
bundle: | |
sourcemaps: true | |
caching: false | |
stats: true | |
linting: true | |
apiGatewayUrl: | |
Fn::Join: | |
- '' | |
- - 'https://' | |
- Ref: ApiGatewayRestApi | |
- '.execute-api.${self:provider.region}.amazonaws.com/${self:provider.stage}' | |
bucket: ${ssm:/you-betta-rekognize/BUCKET~true} | |
twitterConsumerAPIKey: ${ssm:/you-betta-rekognize/TWITTER_CONSUMER_API_KEY~true} | |
twitterConsumerAPIKeySecret: ${ssm:/you-betta-rekognize/TWITTER_CONSUMER_API_KEY_SECRET~true} | |
twitterAccessToken: ${ssm:/you-betta-rekognize/TWITTER_ACCESS_TOKEN~true} | |
twitterAccessTokenSecret: ${ssm:/you-betta-rekognize/TWITTER_ACCESS_TOKEN_SECRET~true} | |
twitterDevEnvironment: youbettarekognize | |
provider: | |
name: aws | |
profile: personal # Or whatever you named your profile when you configured the Serverless CLI | |
region: ${opt:region, 'us-west-2'} | |
runtime: nodejs10.x | |
stage: ${opt:stage, 'dev'} | |
iamRoleStatements: | |
- Effect: Allow | |
Action: | |
- rekognition:DetectLabels | |
- rekognition:RecognizeCelebrities | |
Resource: '*' | |
- Effect: Allow | |
Action: | |
- s3:PutObject | |
- s3:PutObjectAcl | |
- s3:GetObject | |
Resource: | |
- Fn::Join: | |
- ':' | |
- - 'arn' | |
- 'aws' | |
- 's3' | |
- ':' | |
- ${self:custom.bucket}/* | |
environment: | |
BUCKET: ${self:custom.bucket} | |
NODE_ENV: ${self:provider.stage} | |
API_GATEWAY_URL: ${self:custom.apiGatewayUrl} | |
TWITTER_CONSUMER_API_KEY: ${self:custom.twitterConsumerAPIKey} | |
TWITTER_CONSUMER_API_KEY_SECRET: ${self:custom.twitterConsumerAPIKeySecret} | |
TWITTER_ACCESS_TOKEN: ${self:custom.twitterAccessToken} | |
TWITTER_ACCESS_TOKEN_SECRET: ${self:custom.twitterAccessTokenSecret} | |
TWITTER_DEV_ENV: ${self:custom.twitterDevEnvironment} | |
functions: | |
customAuthorizer: | |
handler: src/functions/authorizer.authorize | |
healthCheck: | |
handler: src/functions/healthCheck.handler | |
events: | |
- http: | |
path: healthcheck | |
method: post | |
# This will run our requests through the authorizer first, | |
# before hitting the health check function | |
authorizer: customAuthorizer | |
getToken: | |
handler: src/functions/authorizer.getToken | |
events: | |
- http: | |
path: auth/token | |
method: post | |
registerWebhook: | |
handler: src/functions/webhook.register | |
events: | |
- http: | |
path: webhook/register | |
method: post | |
authorizer: customAuthorizer | |
deregisterWebhook: | |
handler: src/functions/webhook.deregister | |
events: | |
- http: | |
path: webhook/deregister | |
method: delete | |
authorizer: customAuthorizer | |
validateWebhook: | |
handler: src/functions/webhook.validate | |
events: | |
- http: | |
path: webhook/process | |
method: get | |
addSubscription: | |
handler: src/functions/subscription.add | |
events: | |
- http: | |
path: subscription/add | |
method: post | |
authorizer: customAuthorizer | |
removeSubscription: | |
handler: src/functions/subscription.remove | |
events: | |
- http: | |
path: subscription/remove | |
method: delete | |
authorizer: customAuthorizer | |
processTweet: | |
handler: src/functions/webhook.process | |
events: | |
- http: | |
path: webhook/process | |
method: post | |
respondToTweet: | |
handler: src/functions/tweet.respond | |
events: | |
- s3: | |
bucket: ${self:custom.bucket} | |
event: s3:ObjectCreated:* | |
existing: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment