Skip to content

Commit c93b77c

Browse files
committed
test formatting
1 parent d838313 commit c93b77c

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

articles/azure-functions/migration/lambda-functions-migration-migrate.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ The following snippets are examples of common SDK code. The AWS Lambda code maps
3232
:::row:::
3333
:::column span="":::
3434

35+
AWS Lambda code (SDK)
36+
37+
```
3538
const AWS = require('aws-sdk');
3639
const s3 = new AWS.S3();
3740
@@ -45,10 +48,14 @@ The following snippets are examples of common SDK code. The AWS Lambda code maps
4548
console.log('File content:',
4649
data.Body.toString());
4750
};
51+
```
4852

4953
:::column-end:::
5054
:::column span="":::
5155

56+
Azure Functions code (Trigger)
57+
58+
```
5259
import { app } from '@azure/functions';
5360
5461
app.storageblob('blobTrigger', {
@@ -58,39 +65,40 @@ The following snippets are examples of common SDK code. The AWS Lambda code maps
5865
context.log(`Blob content:
5966
${myBlob.toString()}`);
6067
});
61-
68+
```
69+
6270
:::column-end:::
6371
:::row-end:::
6472
6573
| AWS Lambda code (SDK) | Azure Functions code (Trigger) |
6674
|---|---|
6775
| 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> }); |
6876

69-
**Writing to SQS (AWS) vs. Queue Storage (Azure)**
77+
**Writing to Amazon Simple Queue Service (SQS) versus Queue Storage**
7078

7179
| AWS Lambda code (SDK) | Azure Functions code (Trigger) |
7280
|---|---|
7381
| 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}`); }); |
7482

75-
**Writing to a DynamoDB vs. Cosmos DB**
83+
**Writing to DynamoDB versus Azure Cosmos DB**
7684

7785
| AWS Lambda code (SDK) | Azure Functions code (Trigger) |
7886
|---|---|
7987
| 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)}`); }); }); |
8088

81-
**AWS CloudWatch Events vs Azure Timer Trigger**
89+
**Amazon CloudWatch Events versus Azure timer trigger**
8290

8391
| AWS Lambda code (SDK) | Azure Functions code (Trigger) |
8492
|---|---|
8593
| 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()}); }); |
8694

87-
**AWS SNS vs Azure EventGrid Trigger**
95+
**Amazon Simple Notification Service (SNS) versus Azure Event Grid Trigger**
8896

8997
| AWS Lambda code (SDK) | Azure Functions code (Trigger) |
9098
|---|---|
9199
| 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)}`); }); |
92100

93-
**AWS Kinesis vs Azure EventHubs Trigger**
101+
**Amazon Kinesis vs Azure Event Hubs trigger**
94102

95103
| AWS Lambda code (SDK) | Azure Functions code (Trigger) |
96104
|---|---|

0 commit comments

Comments
 (0)