Through this blog, I’ll take you through the tutorial on uploading AWS live audio streaming to AWS S3 audio streaming using AWS SDK.

We will use certain services of AWS which includes Amazon Cognito Identity Pools (federated identities), and S3 ofcourse.

AWS Configurations

Assuming you have logged into the AWS console, let us get started by creating a S3 Bucket, where all the audio files will be stored. To create the bucket, navigate to AWS S3 -> Create bucket

Once the bucket is created, our next step is to create a Federated Identity which provides the necessary permission for a file upload from browser to S3 bucket.

To create the Federated Identity please navigate to the Cognito service - > Manage identity pools > Create new identity.

Give the Identity pool name and check the Enable access to unauthenticated identities Or Authentication Providers.

The next screen is all about setting the necessary permission for the Federated Identity via IAM roles. Here, we will create a new IAM role with specific permission defined via custom policy as policy mentioned below:

Post creation, it will provide the Identity Pool Id. That ID is required to communicate with AWS services.

Front-end App

Now we will create a small front-end app to record and upload audio stream to S3.



We will create a AudioStream class which will have functions used in above HTML events and also the one used to upload the audio stream to s3.


1- audioStreamInitialize function is used to request the microphone permission, and on receiving the data, it will create a multi-part upload.

Start and Stop Recording:

1- startRecording function will be triggered when we start a new recording.

2- stopRecording

Uploading to AWS S3 Audio Streaming:

1- startMultiUpload

2- continueMultiUpload

3- completeMultiUpload

This is how you can upload the live streaming audio to S3 bucket via front-end using AWS SDK. 

To find a working example, refer to my blog on uploading audio stream to AWS S3.


Posts You May Like...