kokoichi206 / cloud-prac

0 stars 0 forks source link

AWS-SAA: CloudFront + Route53 #1

Closed kokoichi206 closed 2 years ago

kokoichi206 commented 2 years ago

AWS-SAA でよくみる構成を作ってみるシリーズ

Screen Shot 2022-07-08 at 2 40 52

S3 で SPA をホスト

https://github.com/kokoichi206/cloud-prac/tree/main/aws_saa/cloud_front_s3

kokoichi206 commented 2 years ago

CloudFront の apply は3分近くかかった

aws_cloudfront_distribution.static-www: Creating...
aws_cloudfront_distribution.static-www: Still creating... [10s elapsed]
aws_cloudfront_distribution.static-www: Still creating... [20s elapsed]
aws_cloudfront_distribution.static-www: Still creating... [30s elapsed]
aws_cloudfront_distribution.static-www: Still creating... [40s elapsed]
aws_cloudfront_distribution.static-www: Still creating... [50s elapsed]
aws_cloudfront_distribution.static-www: Still creating... [1m0s elapsed]
aws_cloudfront_distribution.static-www: Still creating... [1m10s elapsed]
aws_cloudfront_distribution.static-www: Still creating... [1m20s elapsed]
aws_cloudfront_distribution.static-www: Still creating... [1m30s elapsed]
aws_cloudfront_distribution.static-www: Still creating... [1m40s elapsed]
aws_cloudfront_distribution.static-www: Still creating... [1m50s elapsed]
aws_cloudfront_distribution.static-www: Still creating... [2m0s elapsed]
aws_cloudfront_distribution.static-www: Still creating... [2m10s elapsed]
aws_cloudfront_distribution.static-www: Still creating... [2m20s elapsed]
aws_cloudfront_distribution.static-www: Still creating... [2m30s elapsed]
aws_cloudfront_distribution.static-www: Still creating... [2m40s elapsed]
aws_cloudfront_distribution.static-www: Creation complete after 2m47s [id=EB3H2DPNWKDYV]

メモ

kokoichi206 commented 2 years ago

Links

kokoichi206 commented 2 years ago

This site can’t provide a secure connection

aws_cloudfront_distribution の aliases にドメインを追加してないせい発生していた。

DNS サービスとしての Route53 は、名前解決したら1回ユーザーにボールを返しているイメージだった。 そこから再度 CloudFront にアクセスすると思ってたけど、、、

ただ、AWS Cloud から出ない方がパフォーマンスは良さそうだから、そうなっている??? そうだとしたら エイリアス は要りそう。

kokoichi206 commented 2 years ago

CloudFront メモ

resource "aws_cloudfront_distribution" "static-www" {
  ...
  # 配信制限
  restrictions {
    geo_restriction {
      restriction_type = "none"
      # none でも locations がないとエラーになる
      locations = []
      # restriction_type = "whitelist"
      # locations        = ["JP"]
    }
  }
  ...