AWSary - Creation of S3 bucket

I created a proof of concept (POC) for the iOS app AWSary, with a quick and dirty backend on a docker NGINX image.

Now that I decided to move the backend to AWS, we will need to setup multiple things.

First things first, we need a S3 bucket to store and serve the static resources like images, for that let's create a private S3 bucket and later put CloudFront feeding from this bucket and serving the files with a CDN. (more on this on a future article)

locals {
  bucket_name = "s3-awsary-assets"
}

module "s3_bucket" {
  source = "terraform-aws-modules/s3-bucket/aws"

  bucket = local.bucket_name
  acl    = "private"

  # S3 bucket-level Public Access Block configuration
  block_public_acls       = true
  block_public_policy     = true
  ignore_public_acls      = true
  restrict_public_buckets = true
}

We define locals with the bucket name (remember it needs sto be unique world wide, since by default an https endpoint will be available)

Then we are going to use the https://serverless.tf framework and deploy terraform-aws-modules, setting some options like acls to ensure the bucket will be private.

Now we are good to go, populate some static files on this bucket, for later serve them with CloudFront.

You can join us on this project at https://github.com/tigpt/AWSary, suggest some modifications, exchange ideas and so on.