- Open Roles page
- Click create role
- Select Lambda (allows lambda function to call AWS services on your behalf)
- Next: Permissions
- search for "AWSLambdaExecute" and select
- Next, next
- Role name: lambda-s3-role
- Click create role
- Services->Lambda
- name: upload-weather
- Python 3.8
- Use an existing role: lambda-s3-role
- create function
- same as "Lambda function for upload data" but with name: get-weather
- Bucket name: clint-weather-data
- permission as default: block all public access
- click create bucket
- Action->Create resource and then choose a name
- REST API click build
- REST api radio selected
- New API selected
- API name: room-weather
- Endpoint type: Regional
- Click create API
- Actions->Create Method and select: PUT
- Integration Type: Lambda Function
- Check: Use Lambda Proxy Integration
- lambda function name: upload-weather
- click save
- on left side: click Models
- Click create
- model name: putWeather
- content-type: application/json
- see schema file in this repo named "putWeather"
- Click on your "PUT" method
- Method execution
- Settings, API Key Required: true
- Request body, content-type: application/json
- Request body, select model name: putWeather
- Service->API Gateway
- Action->Create resource
- Action->Create Method (see steps from API Gateway)
- API->Gateway->room-weather
- Actions->Create API key
- name: raspberryPi
- Auto Generate
To protect yourself from accidentally calling it too much. This is optional
- name: RaspberryPiPlan
- requests per second: 2
- burst: 3
- 172,800 requests per day (2 * seconds in a day)
- Next
- Add API stage: room-weather
- Add api key to plan: raspberryPi
- name the stage: room-weather
- Enable throttling: choose a reasonable limit
- Go to Usage Plan and add this stage to your useage plan
- Services->AWS Certification Manager
- Provision Certificates
- Request public certificate
- add three domain scenarios i.e.
- clintpitzak.com
- *.clintpitzak.com
- www.clintpitzak.com
- Select verification method
- API Gateway->Custom domain names
- api.clintpitzak.com
- Regional
- TLS 1.2
- clintpitzak.com ACM certificate
- create
- copy API Gateway domain name
- 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
- Go back to the custom domain. Click on your custom domain
- Click API Mapping, add new mapping
- Select your api and stage