# Lambda → Create function # Name: hello-function # Runtime: Python 3.12 # Click Create # lambda_function.py (editor မှာ ရေး) import json def lambda_handler(event, context): name = event.get('name', 'World') return { 'statusCode': 200, 'body': json.dumps({ 'message': f'Hello, {name}!', 'status': 'success' }) } # Test event { "name": "Ko Min" }
# API Gateway → Create API → HTTP API # Add integration: Lambda function ရွေး # Route: GET /hello # Deploy → URL ရမယ် # Lambda function (Node.js example) exports.handler = async (event) => { const name = event.queryStringParameters?.name || 'World' return { statusCode: 200, headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ message: `Hello, ${name}!` }) } } # Call the API # GET https://abc123.execute-api.ap-southeast-1.amazonaws.com/hello?name=Ko+Min # Response: {"message": "Hello, Ko Min!"}
| Trigger | ဘာဖြစ်ရင် run မလဲ |
|---|---|
| API Gateway | HTTP request ရောက်ရင် |
| S3 Event | File upload ဖြစ်ရင် (e.g. resize image) |
| EventBridge (Cron) | Scheduled time (e.g. every day 9am) |
| DynamoDB Stream | Database change ဖြစ်ရင် |
| SQS | Message queue ဝင်ရင် |
| SNS | Notification ပေးပို့ရင် |
# EventBridge → Rules → Create rule # Schedule: cron(0 9 * * ? *) ← every day 9am UTC # Target: Lambda function # Cron examples cron(0 9 * * ? *) # Every day at 9am UTC cron(0/5 * * * ? *) # Every 5 minutes cron(0 0 1 * ? *) # First day of month # Use case: Daily email report, cleanup old data, backup
← AWS 04 | Next: AWS 06 → Deploy →