How do I use API Gateway to create files, folders, and subfolders in Amazon S3?
3 minute read
I want to use Amazon API Gateway to create files, folders, and subfolders in an Amazon Simple Storage Service (Amazon S3) bucket. I don't want to use an intermediate AWS Lambda function.
To reduce the latency of API requests, use API Gateway without a Lambda function to create Amazon S3 bucket resources. This method can also reduce costs and make your system easier to maintain and troubleshoot.
In the Resource section, select your API, and then select your PUT method.
In the rest field, enter a name for one of the following. The rest field might be titled differently based on the name of your method.
To create a file in your Amazon S3 bucket, enter the file name.
To create a folder in your Amazon S3 bucket, enter a folder name that ends with %2F. For example, to create a folder named testfolder, enter testfolder%2F.
To create a subfolder in your Amazon S3 bucket, enter the folder name, and then the subfolder name. For example, enter testfolder%2Ftestfolder1%2F to create a subfolder within a folder named testfolder.
A successful test displays an "HTTP 200 OK" response.