template.yaml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # To deploy for the first time, and for each update,
  2. # run both of the following commands in order:
  3. #
  4. # aws cloudformation package \
  5. # --template-file template.yaml \
  6. # --output-template-file template-out.yaml \
  7. # --s3-bucket <your-s3-bucket-name>
  8. #
  9. # aws cloudformation deploy \
  10. # --template-file <path-to-file/template-out.yaml \
  11. # --stack-name <STACK_NAME> \
  12. # --capabilities CAPABILITY_IAM
  13. AWSTemplateFormatVersion: '2010-09-09'
  14. Transform: 'AWS::Serverless-2016-10-31'
  15. Description: Lambda handler for API Gateway - Twilio integration
  16. Resources:
  17. LambdaFunction:
  18. Type: 'AWS::Serverless::Function'
  19. Properties:
  20. Handler: lambda_function.lambda_handler
  21. Runtime: python2.7
  22. CodeUri: s3://<bucket-name>/lambda_function.zip #UPDATE
  23. Description: Lambda handler for API Gateway - Twilio integration
  24. MemorySize: 256
  25. Timeout: 60
  26. Events:
  27. AddPhotoApi:
  28. Type: Api
  29. Properties:
  30. RestApiId: !Ref ApiGatewayApi
  31. Path: /addphoto
  32. Method: GET
  33. ApiGatewayApi:
  34. Type: AWS::Serverless::Api
  35. Properties:
  36. DefinitionUri: s3://<bucket>/swagger.yaml #UPDATE
  37. StageName: Prod
  38. Variables:
  39. # NOTE: Before using this template, replace the <<region>> and <<account>> fields
  40. # in Lambda integration URI in the swagger file to region and accountId
  41. # you are deploying to
  42. LambdaFunctionName: !Ref LambdaFunction
  43. Outputs:
  44. ApiUrl:
  45. Description: URL of your API endpoint
  46. Value: !Join
  47. - ''
  48. - - https://
  49. - !Ref ApiGatewayApi
  50. - '.execute-api.'
  51. - !Ref 'AWS::Region'
  52. - '.amazonaws.com/Prod'