Skip to content

Latest commit

 

History

History
102 lines (92 loc) · 3 KB

File metadata and controls

102 lines (92 loc) · 3 KB

Create the Execution role

  1. Open Roles page
  2. Click create role
  3. Select Lambda (allows lambda function to call AWS services on your behalf)
  4. Next: Permissions
  5. search for "AWSLambdaExecute" and select
  6. Next, next
  7. Role name: lambda-s3-role
  8. Click create role

Lambda function for upload data

  1. Services->Lambda
  2. name: upload-weather
  3. Python 3.8
  4. Use an existing role: lambda-s3-role
  5. create function

Lambda function for getting weather

  1. same as "Lambda function for upload data" but with name: get-weather

Create S3 bucket

  1. Bucket name: clint-weather-data
  2. permission as default: block all public access
  3. click create bucket

API Gateway

  1. Action->Create resource and then choose a name
  2. REST API click build
  3. REST api radio selected
  4. New API selected
  5. API name: room-weather
  6. Endpoint type: Regional
  7. Click create API
  8. Actions->Create Method and select: PUT
  9. Integration Type: Lambda Function
  10. Check: Use Lambda Proxy Integration
  11. lambda function name: upload-weather
  12. click save
  13. on left side: click Models
  14. Click create
  15. model name: putWeather
  16. content-type: application/json
  17. see schema file in this repo named "putWeather"
  18. Click on your "PUT" method
  19. Method execution
  20. Settings, API Key Required: true
  21. Request body, content-type: application/json
  22. Request body, select model name: putWeather

Public method for get weather

  1. Service->API Gateway
  2. Action->Create resource
  3. Action->Create Method (see steps from API Gateway)

Create API Key

  1. API->Gateway->room-weather
  2. Actions->Create API key
  3. name: raspberryPi
  4. Auto Generate

Create Usage Plan

To protect yourself from accidentally calling it too much. This is optional

  1. name: RaspberryPiPlan
  2. requests per second: 2
  3. burst: 3
  4. 172,800 requests per day (2 * seconds in a day)
  5. Next
  6. Add API stage: room-weather
  7. Add api key to plan: raspberryPi

Create Stage

  1. name the stage: room-weather
  2. Enable throttling: choose a reasonable limit
  3. Go to Usage Plan and add this stage to your useage plan

Certification Manager to for a custom domain name for your API

  1. Services->AWS Certification Manager
  2. Provision Certificates
  3. Request public certificate
  4. add three domain scenarios i.e.
  5. Select verification method

Custom domain name

  1. API Gateway->Custom domain names
  2. api.clintpitzak.com
  3. Regional
  4. TLS 1.2
  5. clintpitzak.com ACM certificate
  6. create
  7. copy API Gateway domain name
  8. In your domain manager of where you registered your domain name, go to the DNS section. Add CNAME record for your custom domain name. i.e.
    • name: api.clintpitzak.com.
    • CNAME
    • 10m
    • myapigatewayaddress.amazonaws.com. Note: the periods at the end of the domain names are intentional
  9. Go back to the custom domain. Click on your custom domain
  10. Click API Mapping, add new mapping
  11. Select your api and stage