Trusted entity type: AWS Service
Use case: Lambda
Permissions policies:
- Policy name:
AdministratorAccess
Role name: whosthat
Thing name: whosthat
Device Shadow: No shadow
Policy: whosthat
Policy name: whosthat
Policy document:
- Policy Effect:
Allow
Policy Action:iot:Connect
Policy Resource:*
- Policy Effect:
Allow
Policy Action:iot:Publish
Policy Resource:*
- Policy Effect:
Allow
Policy Action:iot:Receive
Policy Resource:*
- Policy Effect:
Allow
Policy Action:iot:Subscribe
Policy Resource:*
Rule name: whosthat
SQL version: 2016-03-23
SQL statement: SELECT * FROM "location"
Rule actions:
- Action:
Lambda
Lambda function:whosthat
Function name: whosthat
Runtime: Node.js 16.x
Architecture: x86_64
Execution role: Use an existing role
Existing role: whosthat
- Source:
AWS IoT (Custom IoT Rule)
Rule name:whosthat
- Source:
S3
Bucket:whosthat
Event type:All object create events
- Source:
API Gateway
Intent:Create a new API
API type:HTTP API
Security:Open
API name:whosthat
Cross-origin resource sharing (CORS):true
- Event name:
S3-Create
Template:S3 Put
Event JSON:{ "Records.0.s3.object.key": "8df4e168-c926-47b0-9e51-56ff408d41ee-1669106569684.jpg" }
- Event name:
User-Location
Event JSON:{ "user_id": "d8097ad2-fcfa-4846-a166-64ab94435ccf", "location": { "latitude": 1, "longitude": 100 } }
ts-lambda-whosthat/.env.example
Bucket name: whosthat
Object Ownership: ACLs enabled (Bucket owner preferred)
Block Public Access settings for this bucket: Disable all 5 checkboxes
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "whosthat",
"Effect": "Allow",
"Principal": "*",
"Action": ["s3:*"],
"Resource": ["arn:aws:s3:::whosthat", "arn:aws:s3:::whosthat/*"]
}
]
}
[
{
"AllowedHeaders": ["*"],
"AllowedMethods": ["PUT", "POST", "DELETE", "GET"],
"AllowedOrigins": ["*"],
"ExposeHeaders": []
}
]
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: *
Access-Control-Allow-Methods: *
Type: Standard
Name: whosthat
Topic ARN: whosthat
Protocol: Email
Endpoint: {Email Address}
- Table name:
areas
Partition key:id
- Table name:
cameras
Partition key:id
- Table name:
camera_feeds
Partition key:id
- Table name:
reports
Partition key:id
- Table name:
users
Partition key:id
- Table name:
users_areas
Partition key:id
- Table name:
user_locations
Partition key:id