Setting up an S3 bucket

ND
Last updated 3 months ago

Learn how to set up a new or existing S3 bucket so that it can store PDFs generated by Paperplane.

Paperplane uploads PDFs to your own S3 bucket. In order for this to occur, you will need to grant permission to upload files to your bucket. This is done by setting a "bucket policy".

Follow the steps below to create your bucket and apply the policy. You can use the AWS web console or the command line interface.

Setting up a bucket using the web console

Sign in to AWS and open the S3 console in your browser. Click “Create Bucket” and choose a bucket name and region. Continue to step through the wizard (you can leave all the default options unchanged) and create the bucket.

Next you’ll need to give Paperplane permission to upload to the bucket. To do this:

  • Open your bucket in the console

  • Go to the “Permissions” tab

  • Choose “Bucket Policy”

  • Paste in the bucket policy from below, making sure the correct bucket name is set

This quick video walks through the process:

Setting the bucket policy using the AWS web console

Setting up a bucket using the command line interface

If you have the AWS CLI installed and set up, you can create and configure buckets from the command line. To create a bucket, run this command, substituting your preferred bucket name and AWS region:

$ aws s3 mb s3://myapp-bucket-name --region us-west-1

Next, set the bucket policy using the example bucket policy below. You’ll need to have the bucket policy (modified with the correct bucket name) saved as a file.

$ aws s3api put-bucket-policy --bucket myapp-bucket-name --policy file://path/to/policy.json

Bucket policy

When applying the policy make sure to change myapp-bucket-name to the actual name of your bucket.

{
"Id": "PaperplanePolicy",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowPaperplaneAccess",
"Action": [
"s3:PutObject"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::myapp-bucket-name/*",
"Principal": {
"AWS": [
"arn:aws:iam::485347624719:user/s3-upload"
]
}
}
]
}

Next steps

Your bucket is now ready for use!

The next step is to generate an API key using the Paperplane dashboard. This will allow you to start generating PDFs.