Upgrade to Pro — share decks privately, control downloads, hide ads and more …

新機能紹介!CloudFront Functions を触ってみた/Tried out the new CloudFront Functions

ega4432
June 01, 2021
170

新機能紹介!CloudFront Functions を触ってみた/Tried out the new CloudFront Functions

ega4432

June 01, 2021
Tweet

Transcript

  1. 新機能紹介!
    CloudFront Functions
    を触ってみた
    えが(@ega4432)

    View Slide

  2. アジェンダ
    1. Amazon CloudFront
    とは
    2. [email protected]
    とは
    3. CloudFront Functions
    とは
    4. CF2
    の注意点
    5. CF2
    のユースケース
    6. URL
    正規化をやってみた
    7.
    まとめ
    新機能紹介!CloudFront Functions
    を触ってみた
    2021 ©︎ ega4432 - Built with marp. 2

    View Slide

  3. 新機能紹介!CloudFront Functions
    を触ってみた
    Amazon CloudFront
    とは
    2021 ©︎ ega4432 - Built with marp. 3

    View Slide

  4. CloudFront
    とは

    AWS

    CDN
    サービス」
    静的、動的なコンテンツを高速配信
    セキュア
    ユーザを近いエッジロケーションに誘導
    エッジコンピューティングが利用可能
    新機能紹介!CloudFront Functions
    を触ってみた
    2021 ©︎ ega4432 - Built with marp. 4

    View Slide

  5. 新機能紹介!CloudFront Functions
    を触ってみた
    [email protected]
    とは
    2021 ©︎ ega4432 - Built with marp. 5

    View Slide

  6. [email protected]
    とは
    エッジで Lambda
    関数を実行できる機能。
    オリジン
    CloudFront
    新機能紹介!CloudFront Functions
    を触ってみた
    2021 ©︎ ega4432 - Built with marp. 6

    View Slide

  7. 新機能紹介!CloudFront Functions
    を触ってみた
    CloudFront Functions
    とは
    2021 ©︎ ega4432 - Built with marp. 7

    View Slide

  8. CloudFront Functions
    とは
    [email protected]
    よりも安価で軽量な処理を実行できる機能。
    オリジン
    CloudFront
    新機能紹介!CloudFront Functions
    を触ってみた
    2021 ©︎ ega4432 - Built with marp. 8

    View Slide

  9. 新機能紹介!CloudFront Functions
    を触ってみた
    CF2
    の注意点
    2021 ©︎ ega4432 - Built with marp. 9

    View Slide

  10. CF2
    の注意点
    [email protected]
    よりも縛りが多い
    実行時間の制限 1ms
    最大メモリ 2MB
    ランタイムは JavaScript
    だけ
    新機能紹介!CloudFront Functions
    を触ってみた
    2021 ©︎ ega4432 - Built with marp. 10

    View Slide

  11. 新機能紹介!CloudFront Functions
    を触ってみた
    CF2
    のユースケース
    2021 ©︎ ega4432 - Built with marp. 11

    View Slide

  12. CF2
    のユースケース
    HTTP
    リクエスト/レスポンスの操作
    URL
    の書き換えやリダイレクト
    キャッシュの操作
    JWT
    などによるアクセス制御
    新機能紹介!CloudFront Functions
    を触ってみた
    2021 ©︎ ega4432 - Built with marp. 12

    View Slide

  13. 新機能紹介!CloudFront Functions
    を触ってみた
    URL
    正規化をやってみた
    2021 ©︎ ega4432 - Built with marp. 13

    View Slide

  14. 構成
    S3
    CloudFront
    ユーザ
    $ aws s3 ls s3://cloudfront-functions-sample --recursive
    .
    ├── index.html
    └── sample
    └── index.html
    新機能紹介!CloudFront Functions
    を触ってみた
    2021 ©︎ ega4432 - Built with marp. 14

    View Slide

  15. sample
    というオブジェクトは存在しないので 404
    になってしまう
    新機能紹介!CloudFront Functions
    を触ってみた
    2021 ©︎ ega4432 - Built with marp. 15

    View Slide

  16. 目指すかたち
    下記のようにリクエスト URL
    を正規化できれば良さそう!
    / -> /index.html
    /sample -> /sample/index.html
    /sample/ -> /sample/index.html
    新機能紹介!CloudFront Functions
    を触ってみた
    2021 ©︎ ega4432 - Built with marp. 16

    View Slide

  17. 新機能紹介!CloudFront Functions
    を触ってみた
    2021 ©︎ ega4432 - Built with marp. 17

    View Slide

  18. 新機能紹介!CloudFront Functions
    を触ってみた
    2021 ©︎ ega4432 - Built with marp. 18

    View Slide

  19. 新機能紹介!CloudFront Functions
    を触ってみた
    まとめ
    2021 ©︎ ega4432 - Built with marp. 19

    View Slide

  20. まとめ
    CloudFront Functions
    めちゃくちゃ良さそう!
    [email protected]
    との使い分けが重要
    新機能紹介!CloudFront Functions
    を触ってみた
    2021 ©︎ ega4432 - Built with marp. 20

    View Slide

  21. 新機能紹介!CloudFront Functions
    を触ってみた
    ご静聴ありがとうございました
    2021 ©︎ ega4432 - Built with marp. 21

    View Slide