1.5.0 • Published 1 year ago

@apparts/s3deploy v1.5.0

Weekly downloads
7
License
MIT
Repository
github
Last release
1 year ago

#+TITLE: @apparts/s3deploy #+DATE: 2021-02-04 Thu #+AUTHOR: Philipp Uhl

~@apparts/s3deploy~ is a script for deploying static content into an AWS S3 bucket to be served as website. The files are gzip-compressed before they are uploaded.

Only new or updated files are uploaded to save time and bandwidth. Obsolete files can optionally be pruned from the bucket.

The ~allocateStaticSite~ command of ~@apparts/s3deploy~ can be used allocate and set up the required resources for static website hosting. This includes:

  • Creating S3 buckets
  • Creating a hosted zone for the domain
  • Creating and validating an ACM certificate
  • Creating a CloudFront distribution
  • Creating required Route53 DNS entries
  • Usage

You need to export your AWS credentials before you can use this script:

#+BEGIN_SRC sh export AWS_ACCESS_KEY_ID= export AWS_SECRET_ACCESS_KEY= #+END_SRC

** Deploy

The AWS user must at least have S3 ~putObject~ and ~listObject~ permissions to upload and also ~deleteObject~ permissions to prune files.

#+BEGIN_EXAMPLE npx @apparts/s3deploy

Positionals: s3bucket The bucket name to upload to. string local path Directory that should be uploaded. string

Optionen: --version Version anzeigen boolean -f, --forceupload Upload, even when file with same MD5 hash already exists. boolean -p, --prune Prune S3 bucket, aka. delete all files from the bucket that were not found in the local directory. boolean --dontdelete Files or folders that should be ignored when pruning the S3 bucket. array -h, --help Hilfe anzeigen boolean #+END_EXAMPLE

** Allocate AWS resources

The AWS user must at least have these permissions to perform all setup steps:

  • Route 53
    • ListHostedZonesByName
    • ChangeResourceRecordSets
    • CreateHostedZone
    • ListResourceRecordSets
  • ACM
    • RequestCertificate
    • DescribeCertificate
  • CloudFront
    • CreateCloudFrontOriginAccessIdentity
    • CreateDistribution
    • GetDistribution
  • S3
    • CreateBucket
    • ListBuckets
    • PutBucketWebsite
    • PutPublicAccessBlock

#+BEGIN_SRC sh npx -p @apparts/s3deploy -c allocateStaticSite

Positionals: domain-name The domain name under which the site will be hosted. string

Optionen: --version Version anzeigen boolean --s3-bucket-name The name of the S3 bucket to be created. By default it will be the same as the domain name string --region Region to be used string --single-page-app Set Cloudfront up for a single page app boolean --certificate-alt-names Additional names in the SSL certificate array --price-class The chosen price class for cloudfront. 0 is PriceClass_100 (US, MX, CA, EU, Israel) 1 is PriceClass-200 (...PriceClass_100, Sth A, Kenya, Middle East, JP, HK, Philippines, Singapore, Sth Korea, TW, Thailand) 2 is PriceClass_All --skip-create-s3 Use an existing S3 bucket boolean --skip-create-www-s3 Use an existing S3 bucket boolean --use-certificate Use an existing certificate with the specified ARN string --no-www Don't create resources for a www. subdomain boolean -h, --help Hilfe anzeigen boolean #+END_SRC

1.4.2

1 year ago

1.5.0

1 year ago

1.4.1

1 year ago

1.4.0

1 year ago

1.3.1

3 years ago

1.2.1

3 years ago

1.1.0

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago