@@ -32,6 +32,9 @@ The following snippets are examples of common SDK code. The AWS Lambda code maps
32
32
:::row:: :
33
33
:::column span="":: :
34
34
35
+ AWS Lambda code (SDK)
36
+
37
+ ` ` `
35
38
const AWS = require('aws-sdk');
36
39
const s3 = new AWS.S3();
37
40
@@ -45,10 +48,14 @@ The following snippets are examples of common SDK code. The AWS Lambda code maps
45
48
console.log('File content:',
46
49
data.Body.toString());
47
50
};
51
+ ` ` `
48
52
49
53
:::column-end:: :
50
54
:::column span="":: :
51
55
56
+ Azure Functions code (Trigger)
57
+
58
+ ` ` `
52
59
import { app } from '@azure/functions';
53
60
54
61
app.storageblob('blobTrigger', {
@@ -58,39 +65,40 @@ The following snippets are examples of common SDK code. The AWS Lambda code maps
58
65
context.log(` Blob content:
59
66
${myBlob.toString()}`);
60
67
});
61
-
68
+ ` ` `
69
+
62
70
:::column-end:::
63
71
:::row-end:::
64
72
65
73
| AWS Lambda code (SDK) | Azure Functions code (Trigger) |
66
74
|---|---|
67
75
| const AWS = require('aws-sdk'); const s3 = new AWS.S3(); <br><br> exports.handler = async (event) => { const params = { Bucket: 'my-bucket', Key: 'my-object.txt', <br> }; <br> const data = await s3.getObject(params).promise(); console.log('File content:', data.Body.toString()); <br> }; | import { app } from '@azure/functions'; <br><br> app.storageblob('blobTrigger', { <br> path: 'my-container/{blobName}', <br> connection: 'AzureWebJobsStorage', <br> }, async (context, myBlob) => { <br> context.log(` Blob content: ${myBlob.toString()}`); <br> }); |
68
76
69
- **Writing to SQS (AWS) vs. Queue Storage (Azure) **
77
+ **Writing to Amazon Simple Queue Service (SQS) versus Queue Storage**
70
78
71
79
| AWS Lambda code (SDK) | Azure Functions code (Trigger) |
72
80
|---|---|
73
81
| const AWS = require('aws-sdk'); const sqs = new AWS.SQS(); exports.handler = async (event) => { const params = { QueueUrl : ' https://sqs.amazonaws.com/123456789012/MyQueue' , MessageBody: 'Hello, world!', }; await sqs.sendMessage(params).promise(); }; | import { app } from '@azure/functions'; app.queue('queueTrigger', { queueName: 'myqueue-items', connection: 'AzureWebJobsStorage', }, async (context, queueMessage) => { context.log(`Queue message: ${queueMessage}`); }); |
74
82
75
- **Writing to a DynamoDB vs. Cosmos DB**
83
+ **Writing to DynamoDB versus Azure Cosmos DB**
76
84
77
85
| AWS Lambda code (SDK) | Azure Functions code (Trigger) |
78
86
|---|---|
79
87
| const AWS = require('aws-sdk'); const dynamoDb = new AWS.DynamoDB.DocumentClient(); exports.handler = async (event) => { const params = { TableName : ' my-table' , Key: { id: '123' }, }; const data = await dynamoDb.get(params).promise(); console.log('DynamoDB record:', data.Item); }; | import { app } from '@azure/functions'; app.cosmosDB('cosmosTrigger', { connectionStringSetting: 'CosmosDBConnection', databaseName: 'my-database', containerName: 'my-container', leaseContainerName: 'leases', }, async (context, documents) => { documents.forEach(doc => { context.log(`Cosmos DB document: ${JSON.stringify(doc)}`); }); }); |
80
88
81
- **AWS CloudWatch Events vs Azure Timer Trigger **
89
+ **Amazon CloudWatch Events versus Azure timer trigger **
82
90
83
91
| AWS Lambda code (SDK) | Azure Functions code (Trigger) |
84
92
|---|---|
85
93
| exports.handler = async (event) => { console.log('Scheduled event:', event); }; | import { app } from '@azure/functions'; app.timer('timerTrigger', { schedule : ' 0 */5 * * * *' , // Runs every 5 minutes }, async (context, myTimer) => { if (myTimer.isPastDue) { context.log('Timer is running late!'); } context.log(Timer function executed at: ${new Date().toISOString()}); }); |
86
94
87
- **AWS SNS vs Azure EventGrid Trigger**
95
+ **Amazon Simple Notification Service ( SNS) versus Azure Event Grid Trigger**
88
96
89
97
| AWS Lambda code (SDK) | Azure Functions code (Trigger) |
90
98
|---|---|
91
99
| const AWS = require('aws-sdk'); const sns = new AWS.SNS(); exports.handler = async (event) => { const params = { Message : ' Hello, Event Grid!' , TopicArn: 'arn:aws:sns:us-east-1:123456789012:MyTopic', }; await sns.publish(params).promise(); }; | import { app } from '@azure/functions'; app.eventGrid('eventGridTrigger', {}, async (context, eventGridEvent) => { context.log(`Event Grid event: ${JSON.stringify(eventGridEvent)}`); }); |
92
100
93
- **AWS Kinesis vs Azure EventHubs Trigger **
101
+ **Amazon Kinesis vs Azure Event Hubs trigger **
94
102
95
103
| AWS Lambda code (SDK) | Azure Functions code (Trigger) |
96
104
|---|---|
0 commit comments