Uploading Files to S3
In this lesson, you will learn how to upload files to S3 by modifying the template file.
You added a web-site
directory to your project, with static web assets. Before you can deploy the new version of the application, you need to send those assets to S3 and replace the placeholder for the API URL in the index file.
At the time this was written, CloudFormation didn’t have any built-in support for sending web asset files to S3. However, there is a component in the AWS Serverless Application Repository that can handle simple uploads to S3, which is just what you need to deploy everything at the same time. DeployToS3
, created by Aleksandar Simović, can upload files to S3 and optionally replace patterns in those files with CloudFormation references. That component will make it very easy to coordinate API Gateway updates and static website assets. Import the component into the application template by adding it to the Resources
section. The code from the following listing will be added and indented so it aligns with existing resources (for example ConvertFileFunction
).
Get hands-on with 1400+ tech skills courses.