Uploading Videos to YouTube with Amazon S3
Tags: aws, youtube, fileupload
Published: 2022-11-07 09:58:09

## What is Amazon S3 

Amazon S3 (Amazon Simple Storage Service) is an object storage service that can store and manage different forms of data. S3 stores these data as object within “buckets”. Files that can be stored include videos, audio, images, and text. This data can be accessed and utilized whenever needed. Amazon S3 is easy to set up, implement and has cost-management features; it provides cheaper storage capabilities.

## Connecting to S3

To get started with Amazon S3, you will need an [Amazon Web Services](https://aws.amazon.com/) account. In your browser, log in to AWS if you already have an account, otherwise, [create a new user account](https://portal.aws.amazon.com/billing/signup?nc2=h_ct&src=header_signup&redirect_url=https%3A%2F%2Faws.amazon.com%2Fregistration-confirmation#/start/email).

**Bucket and Folder setup**
A bucket in AWS is a container for storing data objects. in your AWS account, you can have numerous buckets and also store lots of data in each bucket. To create a bucket, a bucket name and an AWS region are required. After which we can upload objects to be stored in the created bucket. Objects to be stored are assigned a unique key identifier for ease of access.
To create a bucket, navigate to the services section of your dashboard and enter “S3” in the search bar:

![searching for AWS S3](https://paper-attachments.dropbox.com/s_1D00816BDA5D76A6822B3317BE8294FC2B1EB3BBF8A5AF90FDCA8E4566406384_1656049636649_us-east-1.console.aws.amazon.com_console_home_nc2h_ctregionus-east-1srcheader-signinScreenshot+for+article+1.png)


On the new page that opens up, click on the “Create bucket” button. In the form on the next page, enter the name and region of your bucket, uncheck “block all public access”, and finally, click on the “Create bucket” button at the bottom of the page.

## Restricting Access 

There are different ways to secure data uploaded on AWS S3. Some of this methods are:

- User access can be restricted to particular IAM users. This can be done by writing [IAM user policies](https://docs.aws.amazon.com/AmazonS3/latest/dev/example-policies-s3.html). This steps involves writing scripts in a console that define how particular IAM users can access a bucket and also additional permissions for adding, updating or deleting objects from the bucket.
- Writing [bucket policies](https://docs.aws.amazon.com/AmazonS3/latest/dev/example-policies-s3.html) to define access permissions to your bucket and the object stored in it. Only the owner of the bucket can define a policy for it. Policies created apply to all objects in the bucket. Bucket policies allows the owner grant permissions, or allow or block access to a bucket under various conditions.
- Blocking public access for buckets that should not be available to public users.


## Uploading Files from PC to Amazon

To upload files to your bucket, on the AWS S3 page, click on your created bucket from the list of buckets at the bottom of the page.

![a created bucket](https://paper-attachments.dropbox.com/s_1D00816BDA5D76A6822B3317BE8294FC2B1EB3BBF8A5AF90FDCA8E4566406384_1656051458858_s3.console.aws.amazon.com_s3_buckets_myappsmithbucket_regionus-east-1tabobjectsScreenshot+for+article.png)


Next, click on the “Upload” button to add videos from your PC to your bucket. On the new page, click on “add File” to upload single files, or click on “add Folder” to add an entire folder to your bucket.

![add  file or folder](https://paper-attachments.dropbox.com/s_1D00816BDA5D76A6822B3317BE8294FC2B1EB3BBF8A5AF90FDCA8E4566406384_1656051593202_s3.console.aws.amazon.com_s3_buckets_myappsmithbucket_regionus-east-1tabobjectsScreenshot+for+article+1.png)


Navigate through your system directory and add the desired file(s). When you add a file(s), the file name and size will be displayed:

![uploaded files](https://paper-attachments.dropbox.com/s_1D00816BDA5D76A6822B3317BE8294FC2B1EB3BBF8A5AF90FDCA8E4566406384_1656052108696_s3.console.aws.amazon.com_s3_upload_myappsmithbucket_regionus-east-1Screenshot+for+article.png)


Click on the “Upload” button to add the file to AWS S3. There’s a new page with a progress bar that shows the process of the file getting uploaded. After a successful upload, it shows upload succeeded on the screen:

![upload successful](https://paper-attachments.dropbox.com/s_1D00816BDA5D76A6822B3317BE8294FC2B1EB3BBF8A5AF90FDCA8E4566406384_1656052346761_s3.console.aws.amazon.com_s3_upload_myappsmithbucket_regionus-east-1Screenshot+for+article+1.png)


To view the uploaded video in a the browser, click on the uploaded video and navigate to the “permissions” tab. If you get a bucket owner prompt similar to the below image:


![view uploaded items](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kycj5zspt0uh8yzp2sw9.png)




You can switch access control to ACL by clicking on the “bucket owner enforced” link and setting object ownership to ACLs enabled on the new page. With that done, we can now make the video public with ACL. To do this, click on object actions and select “make public with ACL” at the bottom:


![make object public](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sxw1hc1sdbislq93ukgr.png)

Finally, click on the “Make public” button on the next page. With this done, you can access the video with the object URL from the properties section. 

## Connecting Amazon S3 to YouTube

There are different web platforms that offer services to connect AWS S3 to YouTube. An example of such platform is [Zapier](https://zapier.com/). To make use of Zapier, [create a new user account](https://zapier.com/app/login?next=https%3A%2F%2Fworkflows.zapier.com%2F%3Fid%3D28e222f5-557f-4906-8df8-8723e14122b9%26context%3D12479104%23readAuth) on the website. Next, [connect your Amazon S3 account to Zapier](https://workflows.zapier.com/?id=e23145b7-30f8-439a-a85a-dc8c30552b42&context=12806106#readAuth):

![Zapier and AWS connect](https://paper-attachments.dropbox.com/s_1D00816BDA5D76A6822B3317BE8294FC2B1EB3BBF8A5AF90FDCA8E4566406384_1656054655795_workflows.zapier.com__ide23145b7-30f8-439a-a85a-dc8c30552b42context12806106Screenshot+for+article.png)


Click on the “Connect” button. An `access key id` and `secret key`  are required to connect the AWS account to Zapier. If you don’t have one, on your dashboard click on “account”, then click on “security credentials”:

![security credentials](https://paper-attachments.dropbox.com/s_1D00816BDA5D76A6822B3317BE8294FC2B1EB3BBF8A5AF90FDCA8E4566406384_1656055139933_security+credentials.png)


On the new page that opens up, select “access key” and click on “Create new access key”. A new key will be created for you. You can either download the key, or copy and store this key somewhere as it would only be displayed once. Copy and paste the `access key` and `secret key` in the required fields to connect the AWS account to Zapier. When this is done the account gets linked to Zapier and we can continue to the next step:

![account linked to Zapier](https://paper-attachments.dropbox.com/s_1D00816BDA5D76A6822B3317BE8294FC2B1EB3BBF8A5AF90FDCA8E4566406384_1656055686806_workflows.zapier.com__ide23145b7-30f8-439a-a85a-dc8c30552b42context12806106Screenshot+for+article+1.png)


The next step is to connect the YouTube account that will be linked to the AWS S3 bucket with Zapier:

![Connect YouTube](https://paper-attachments.dropbox.com/s_1D00816BDA5D76A6822B3317BE8294FC2B1EB3BBF8A5AF90FDCA8E4566406384_1656055803040_workflows.zapier.com__ide23145b7-30f8-439a-a85a-dc8c30552b42context12806106Screenshot+for+article+2.png)


Click on the “Connect” button to sign in and allow Zapier access to your YouTube. Click on the “Next” button when this is done.
There is a new page where we define the fields we want Zapier to edit:

![define Zapier entries](https://paper-attachments.dropbox.com/s_1D00816BDA5D76A6822B3317BE8294FC2B1EB3BBF8A5AF90FDCA8E4566406384_1656056121645_workflows.zapier.com__ide23145b7-30f8-439a-a85a-dc8c30552b42context12806106Screenshot+for+article+3.png)


 The required fields are selected by default. Click on the “Next” button to continue. Leave the other fields blank. And finally turn on Zap in the last section.

![turn on zap](https://paper-attachments.dropbox.com/s_1D00816BDA5D76A6822B3317BE8294FC2B1EB3BBF8A5AF90FDCA8E4566406384_1656059260755_workflows.zapier.com__ide23145b7-30f8-439a-a85a-dc8c30552b42context12806106Screenshot+for+article+5.png)


 To handle creating and adding new files from a bucket on S3 to YouTube, we will create a new zap for this. Click on the “Create Zap” button on the navigation menu. Select Amazon S3 from the list of events and click on “Continue”:

![connect aws to youtube connection on zapier](https://paper-attachments.dropbox.com/s_1D00816BDA5D76A6822B3317BE8294FC2B1EB3BBF8A5AF90FDCA8E4566406384_1656059380289_zapier.com_editor_160036158_draft_160036158_setupScreenshot+for+article.png)


 Select your account and in the next section, select the bucket you wish to link to YouTube:

![select user account](https://paper-attachments.dropbox.com/s_1D00816BDA5D76A6822B3317BE8294FC2B1EB3BBF8A5AF90FDCA8E4566406384_1656059494246_zapier.com_editor_160036158_draft_160036158_fieldsScreenshot+for+article.png)


 Next, set the trigger event to new or updated file and click on “Continue”:

![set event trigger](https://paper-attachments.dropbox.com/s_1D00816BDA5D76A6822B3317BE8294FC2B1EB3BBF8A5AF90FDCA8E4566406384_1656059531523_zapier.com_editor_160036158_draft_160036158_sampleScreenshot+for+article.png)


 For the action to be executed, select YouTube: 

![upload to youtube](https://paper-attachments.dropbox.com/s_1D00816BDA5D76A6822B3317BE8294FC2B1EB3BBF8A5AF90FDCA8E4566406384_1656059582622_zapier.com_editor_160036158_draft_160036159_setupScreenshot+for+article.png)


And for the event, select “Upload Video” and choose the YouTube account in the next section. For the “set up action” section we will use the file in the S3 bucket to fill the fields. Set the `Privacy Status` field to unlisted

![set privacy](https://paper-attachments.dropbox.com/s_1D00816BDA5D76A6822B3317BE8294FC2B1EB3BBF8A5AF90FDCA8E4566406384_1656059697412_zapier.com_editor_160036158_draft_160036159_fieldsScreenshot+for+article.png)


Finally, click on publish zap, and turn on the zap:

![publish created zap](https://paper-attachments.dropbox.com/s_1D00816BDA5D76A6822B3317BE8294FC2B1EB3BBF8A5AF90FDCA8E4566406384_1656059749201_zapier.com_editor_160036158_draft_160036159_sampleScreenshot+for+article.png)


When all this steps are completed, if we add a new video the the bucket on S3:

![testing zap](https://paper-attachments.dropbox.com/s_1D00816BDA5D76A6822B3317BE8294FC2B1EB3BBF8A5AF90FDCA8E4566406384_1656059966699_s3.console.aws.amazon.com_s3_buckets_myappsmithbucket_regionus-east-1tabobjectsScreenshot+for+article+2.png)


The zap executes and uploads the video to the YouTube channel. We can view the zap detail log to see this:

![zapier log](https://paper-attachments.dropbox.com/s_1D00816BDA5D76A6822B3317BE8294FC2B1EB3BBF8A5AF90FDCA8E4566406384_1656060022603_zapier.com_app_history_00c367da-f79b-ad16-b526-40db3c6ff1f1_zapId160036158Screenshot+for+article.png)


The uploaded video shows up on the YouTube channel:


![video uploaded to youtube](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vvpt6ta1nw3x3ook3cft.png)

## Conclusion

In this tutorial, we learned how we can create a bucket on AWS S3, upload videos to the bucket and connect the bucket to YouTube for automatic deployments.