AWS S3 Bucket Connectivity Using Azure Functions
AWS S3 Bucket Connectivity Using Azure Functions
Naveen Muppa
10494 Red Stone Dr
Collierville, Tennessee
Abstract
The paper focus is on connectivity setup procedure between Logic Apps and AWS S3 Bucket using
GET and PUT method. Before proceeding to the next section, we assume a valid Logic Apps
subscription and AWS S3 bucket details (along with client_id and client secret) is already in place.
Keywords: Due to absence of S3 connector in Logic Apps, connectivity setup is dealt with via
Azure Function and HTTP connector in Logic Apps for download/upload of data. Azure Function
is designed to list the files (S3 bucket content), handle Unicode characters and large data transfer
(for inbound and outbound transactions)
I. INTRODUCTION
Azure Functions is a serverless computing service provided by Microsoft Azure, allowing you to
run small pieces of code (functions) without having to worry about managing the underlying
infrastructure.
Azure Functions supports multiple programming languages such as C#, JavaScript, Python, etc.
You can use the AWS SDK for the language of your choice within your Azure Function to interact
with S3. For example, if you're using C#, you can use the AWS SDK for .NET.
To access resources in your AWS S3 bucket, you'll need to provide appropriate AWS credentials
(Access Key ID and Secret Access Key) to your Azure Function. These credentials should be
securely stored and managed, such as using Azure Key Vault or Azure Managed Identities.
Ensure that the IAM (Identity and Access Management) role associated with the AWS credentials
has the necessary permissions to access the S3 bucket and perform the required operations (read,
write, etc.). You can define a specific IAM role with the least privilege principle for your Azure
Function.
Azure Functions can be triggered by various events such as HTTP requests, timers, or messages
from Azure services. When integrating with S3, you might want your function to trigger when a
new file is uploaded to the S3 bucket or when an existing file is modified.
Once triggered, your Azure Function can execute custom logic to process the files in the S3 bucket.
This could involve reading the file content, performing transformations or analysis, and possibly
writing the results back to another storage location or triggering further actions.
Implement robust error handling within your Azure Function to handle any exceptions that might
occur during the interaction with S3. Additionally, utilize logging mechanisms provided by Azure
Functions to track the execution flow and diagnose issues.
1
International Journal of Core Engineering & Management
Volume-7, Issue-05, 2023 ISSN No: 2348-9510
II. LISTING AND DOWNLOADING FILES FROM S3 BUCKET VIA GET METHOD
Download Files from AWS S3 Bucket: Below mentioned steps will help to list files from a S3 bucket
and download the same via Logic Apps:
Using Azure Function, file listing is performed. Bucket Name, File Path and Region details are
passed as an input to the function in Logic Apps.
Using below code snippet we can list the files residing in AWS S3 bucket. Client_Id and Client
secret details are needed to be updated in the codebase accordingly. The function expects its input
to be bucket Name, file path and region details which are to be passed from Logic Apps.
Depending upon these details, file listing is performed.
Code snippet:
Function Declaration along with necessary variables like client_id, client secret, region, bucket
Name etc. are initialized. It is designed to assign dynamic values at runtime from Body Data.
2
International Journal of Core Engineering & Management
Volume-7, Issue-05, 2023 ISSN No: 2348-9510
3
International Journal of Core Engineering & Management
Volume-7, Issue-05, 2023 ISSN No: 2348-9510
4
International Journal of Core Engineering & Management
Volume-7, Issue-05, 2023 ISSN No: 2348-9510
Authorization and Hash Key details are mandatory attributes which need to be passed in HTTP
header to upload files to S3 bucket. To proceed with the same the output of the previous step
needs to be parsed with Parse JSON action. Input Content of this action is the output body of the
previous Function App. Schema structure can be defined manually where you define how the data
needs to be parsed. It can be also generated in an automated manner by using “Use sample
payload to generate schema”. In this option JSON payload of the function app output can be
provided to generate the schema structure.
HTTP PUT request is initiated to post the desired file “FileName1.txt” to AWS S3 bucket. In
request header, Authorization, Date, Hostname and SHA-256 Hash Key details need to be passed.
5
International Journal of Core Engineering & Management
Volume-7, Issue-05, 2023 ISSN No: 2348-9510
VII. CONCLUSION
This document provides a walkthrough on how to connect with AWS S3 bucket from Azure Logic
Apps for data posting and retrieval along with listing mechanism. Azure Function codebase for
Signature Calculation is extensively tested with data content <=10MB. For data content >10MB
additional changes might be required in the Azure Function codebase. In case of Signature
Mismatch error, validation needs to be done whether similar attributes are passed as input of
Azure Function and in header of GET/POST HTTP request for AWS S3 connect. For further
debugging of Azure Function, Application Insight needs to be configured via Azure Portal to
validate verbose log and test Function App.
6
International Journal of Core Engineering & Management
Volume-7, Issue-05, 2023 ISSN No: 2348-9510
REFERENCES
The following section summarizes the links to external resources that this document references.
The aim of this section is to make it easier for you to add links to your own documentation.
[1] http://www.alessandromoura.com.br/2018/05/19/aws4-signature-logic-apps-azure-
functions.
[2] https://docs.microsoft.com/en-us/azure/azure-functions/functions-twitter-email.