diff --git a/cloud-static-content-hosting/README.md b/cloud-static-content-hosting/README.md index baf009739..bc1e97f7e 100644 --- a/cloud-static-content-hosting/README.md +++ b/cloud-static-content-hosting/README.md @@ -42,6 +42,8 @@ Wikipedia says **Example** +![alt text](./etc/static-content-hosting.png "Static Content Hosting") + In this example we create a static web site using AWS S3 and utilize AWS Cloudfront to distribute the content globally. @@ -131,6 +133,19 @@ error.html * The web site URL format is `http://.s3-website-.amazonaws.com` * E.g. this web site was created in `eu-west-1` region with name `my-static-website-jh34jsjmg` so it can be accessed via url `http://my-static-website-jh34jsjmg.s3-website-eu-west-1.amazonaws.com` +12. Create CloudFormation distribution for the web site. + +* The syntax is described in [this reference](https://docs.aws.amazon.com/cli/latest/reference/cloudfront/create-distribution.html) +* E.g. the easiest way is to call `aws cloudfront create-distribution --origin-domain-name my-static-website-jh34jsjmg.s3.amazonaws.com --default-root-object index.html` +* There's also JSON syntax e.g. `--distribution-config file://dist-config.json` to pass distribution configuration arguments in file +* The output of the call will show you the exact distribution settings including the generated CloudFront domain name you can use for testing e.g. `d2k3xwnaqa8nqx.cloudfront.net` +* CloudFormation distribution deployment takes some time, but once it's completed your web site is served from data centers all around the globe! + +13. That's it! You have implemented a static web site with content distribution network serving it lightning fast all around the world. + +* To update the web site you need to update the objects in S3 bucket and invalidate the objects in the CloudFront distribution +* To do it from AWS CLI see [this reference](https://docs.aws.amazon.com/cli/latest/reference/cloudfront/create-invalidation.html) +* Some further development you might want to do is serve the content over https and add a domain name for your site ## Applicability diff --git a/cloud-static-content-hosting/etc/static-content-hosting.drawio b/cloud-static-content-hosting/etc/static-content-hosting.drawio new file mode 100644 index 000000000..50281e5e6 --- /dev/null +++ b/cloud-static-content-hosting/etc/static-content-hosting.drawio @@ -0,0 +1 @@ +7Vpbc9o6EP41PMZjW77AY0Kh56HttMOcIX3qCCxsNbLlyjKX/PqzMvING9rMQGE4mWQS72olrfbbXe8KBmgcbz8KnEafeUDYwDaD7QB9GNi2hRwL/inObs8ZIc0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jdAuOWSaMMGf/qwHRvlJwqZEyaAJ9C2AAqdxwvnnMQL9bVYRl1YClfJ+aGLOBVr4KGJEFRNA9sjykkFtBWeOEeEwmWelRKqF8Px8pwe6FinYcEx6QaKOYYGXrQaz+0pwgSggP0TcExfoWmcpMZS6g47tZBDvKp0/OmQ30V5cX8o1y44R+NKg3SKY8xhURqasxOuUdgv6DtJsG/8DD5tW1Ue0ai/G16v7A69s3h2r0yUN1uN/e+Xxe86bogO9d9gdVyGN8x+xqRv3llYL3pY7PSQEWQHwmzM3+M1g4xt6cU9Z2eEKua+DdYDMj6KxXFWOOLKWjyHw== \ No newline at end of file diff --git a/cloud-static-content-hosting/etc/static-content-hosting.png b/cloud-static-content-hosting/etc/static-content-hosting.png new file mode 100644 index 000000000..6e0baa95e Binary files /dev/null and b/cloud-static-content-hosting/etc/static-content-hosting.png differ