AWS Summit Tokyo 2023_PayPay

AWS Summit Tokyo 2023_PayPay

More Decks by PayPay Corporation.

Other Decks in Technology

Transcript

  1. ©PayPay Corporation 2 ©PayPay Corporation ⾃⼰紹介 ⻄中 智樹 - Tomoki

    Nishinaka - 名前 所属 役割 PayPay株式会社 Infrastructure Technology部 Cloud Infrastructure Tech Lead AWS IAM Identity Center (AWS SSO) 好きなAWS* サービス *アマゾン ウェブ サービス(AWS)
  2. ©PayPay Corporation 5 ©PayPay Corporation PayPayについて 利⽤シェア率 / 決済回数 国内No.1

    QR 決済プラットフォーム PayPay登録者数5,500万⼈ (2023年2⽉時点) ⼀般社団法⼈キャッシュレス推進協議会の開⽰資料(2021年度の国内QRコード決済利⽤動向調査結果)から「PayPay」の⽐率を集計、PayPay調べ
  3. ©PayPay Corporation 6 ©PayPay Corporation PayPayについて 1. App Annie「モバイル市場年鑑2022」 アプリダウンロード数

    (⽇本)1 1. PayPay デジタルウォレット/ 決済 2. LINE コミュニケーション 3. ZOOM Cloud Meetings 会議/ ビジネス 4. Instagram ソーシャルメディア 5. Myna Point デジタルウォレット/ 決済 6. YouTube 動画共有/ エンターテインメント 7. Google Maps ナビゲーション 8. TikTok ソーシャルメディア 9. Amazon Prime Video OTT/エンターテインメント 10. Gmail メール 国内 No.1 2021年度 アプリダウンロード数
  4. ©PayPay Corporation 7 ©PayPay Corporation PayPayについて 2018年10⽉ サービス開始当初 2019年4⽉ 2020年4⽉

    2021年6⽉ 2022年3⽉ アプリアップデート 毎週1回以上、年50回以上
  5. ©PayPay Corporation 8 ©PayPay Corporation PayPayについて ⾦融 O2O 決済 公共料⾦・⾏政サービス

    便利なサービス 飲⾷ スーパー/ コンビニ ドラッグ ストア 本屋 オンライン サービス 美容院 ⼩売店 取引履歴 わりかん きせかえ 利⽤レポート 送る・受け取る Tポイントカード 請求書払い 本⼈確認 ふるさと納税 PCR検査キット 新型コロナ通知 マイナポイント フリー マーケット 売上⾦チャージ 銀⾏⼝座登録 PayPay銀⾏ キャリア決済 クレジットカード ATMチャージ あと払い ローン ボーナス運⽤ 実投資 保険 フード デリバリー クーポン テイクアウト タクシー配⾞ テーブル注⽂ スマホ充電 スタンプカード 経費精算 チラシ 暮らしのすべてをスマホ1つで可能にするスーパーアプリ PayPayを起点として⽣活を便利にする
  6. ©PayPay Corporation 9 ©PayPay Corporation PayPayについて – Product – PayPayサービス

    すべてのインフラを 扱うチーム PdM / PMO Designer FE / BE Mobile QA Data ML / AI Product Infra
  7. ©PayPay Corporation 10 Diverse & Multinational Professionals From around 50

    countries -World class Engineering Organization-
  8. ©PayPay Corporation 11 ©PayPay Corporation このセッションの流れ PayPay概要 01 マルチリージョン構成の課題 02

    マルチリージョン構成でのTips 03 マルチリージョン構成の管理について 04 05 まとめ
  9. ©PayPay Corporation 12 ©PayPay Corporation このセッションの流れ PayPay概要 01 マルチリージョン構成の課題 02

    マルチリージョン構成でのTips 03 マルチリージョン構成の管理について 04 05 まとめ
  10. ©PayPay Corporation 15 ©PayPay Corporation PayPayのアーキテクチャ Amazon Managed Streaming for

    Apache Kafka Self Managed Kafkaを運⽤ AWS Key Management Service (AWS KMS)
  11. ©PayPay Corporation 18 ©PayPay Corporation PayPayのアーキテクチャ Amazon OpenSearch ServiceにてLog Platform

    を構築 Amazon Managed Streaming for Apache Kafka AWS Key Management Service (AWS KMS)
  12. ©PayPay Corporation 19 ©PayPay Corporation PayPayのマルチリージョンアーキテクチャ Application Load Balancer AWS

    アジアパシフィック (東京) リージョン AWS アジアパシフィック (⼤阪) リージョン レプリケーション Application Load Balancer AWS Key Management Service (AWS KMS) Amazon Elastic Container Registry (Amazon ECR) AWS Key Management Service (AWS KMS) Amazon Elastic Container Registry (Amazon ECR)
  13. ©PayPay Corporation 20 ©PayPay Corporation このセッションの流れ PayPay概要 01 マルチリージョン構成の課題 02

    マルチリージョン構成でのTips 03 マルチリージョン構成の管理について 04 05 まとめ
  14. ©PayPay Corporation 21 ©PayPay Corporation マルチリージョン構成での課題 - リージョン間は、AZ間ほど⾼速に同期はされず、古いデータにアクセスする可能性がある - リージョン間は、強⼀貫性が担保されたAPIが使えない。(結果整合性となる)

    - リージョン間は、書き込みでのデータ競合に配慮が必要(最終書き込み時間優先) リージョン間のデータ整合性・⼀貫性の確保 - リージョン毎にリソースが作成されるため、⼈的・⾦銭的コストのコントロールが必要 - リージョン毎に意図しない設定があると、正しく動作しない場合がある リソース管理を容易に⾏うこと AZ: アベイラビリティーゾーン
  15. ©PayPay Corporation 22 ©PayPay Corporation このセッションの流れ PayPay概要 01 マルチリージョン構成の課題 02

    マルチリージョン構成でのTips 03 マルチリージョン構成の管理について 04 05 まとめ
  16. ©PayPay Corporation 23 ©PayPay Corporation マルチリージョン構成でのTips Amazon Aurora Amazon DynamoDB

    Amazon S3 AWS Key Management Service (AWS KMS) AWS Secrets Manager AWSのマネージド型サービスを中⼼に紹介します︕ 特にAmazon S3は、特に詳しく︕
  17. ©PayPay Corporation 24 ©PayPay Corporation Amazon Aurora ⼤阪リージョンを利⽤したGlobal Databases Global

    DatabasesによるreplicationがStorage layerで⾏われるためbinlogよりも⾼速 東京リージョン Writer Reader Storage ⼤阪リージョン Reader Reader Storage レプリケーション Primary Cluster Secondary Cluster
  18. ©PayPay Corporation 25 ©PayPay Corporation Amazon Aurora Primary Clusterに問題があれば、Secondary Clusterを昇格させて、書き込みに対応できる

    東京リージョン Writer Reader Storage ⼤阪リージョン Reader Reader Storage レプリケーション Primary Cluster Secondary Cluster
  19. ©PayPay Corporation 26 ©PayPay Corporation Amazon Aurora Primary Clusterに問題があれば、Secondary Clusterを昇格させて、書き込みに対応できる

    東京リージョン Writer Reader Storage ⼤阪リージョン Reader Storage Writer Primary Cluster Secondary Cluster
  20. ©PayPay Corporation 27 ©PayPay Corporation Amazon Aurora remove-from-global-cluster APIを利⽤し、昇格を⼤阪リージョンで完結できる 東京リージョン

    Writer Reader Storage ⼤阪リージョン Reader Storage Primary Cluster Secondary Cluster Writer ⼤阪側から切り離し処理を実⾏
  21. ©PayPay Corporation 30 ©PayPay Corporation Amazon DynamoDB 書き込み先をシステム毎に分けて、システム構築を⾏っている。 強⼀貫性構成 結果整合性構成

    双⽅向レプリケーション 双⽅向レプリケーション リージョン間の結果整合性が担保されない (Consistent Readを使っても)
  22. ©PayPay Corporation 31 ©PayPay Corporation Amazon DynamoDB 書き込み先をシステム毎に分けて、システム構築を⾏っている。 強⼀貫性構成 結果整合性構成

    双⽅向レプリケーション 双⽅向レプリケーション 巨⼤ Table / index を レプリケーションする場合は コストも要確認
  23. ©PayPay Corporation 32 ©PayPay Corporation AWS Key Management Service (AWS

    KMS) マルチリージョンキーを利⽤して、システムの暗号化を安全にサポート Multi Region Primary Key レプリケーション Multi Region Replica Key 東京リージョン ⼤阪リージョン
  24. ©PayPay Corporation 35 ©PayPay Corporation AWS Secrets Manager ⼤阪リージョンにレプリケーションし、シークレットを複製して運⽤ paypay-sec-key

    昇格 paypay-sec-key レプリカから昇格することで、シークレット値の変更などにも対応できる 東京リージョン ⼤阪リージョン
  25. ©PayPay Corporation 36 ©PayPay Corporation Amazon S3 東京リージョン<->⼤阪リージョンで双⽅向でレプリケーションを作成 Paypay-bucket-apne1 Paypay-bucket-apne3

    ⼤阪→東京レプリケーション 東京→⼤阪レプリケーション 東京リージョン ⼤阪リージョン
  26. ©PayPay Corporation 37 ©PayPay Corporation Amazon S3 Amazon DynamoDB同様書き込み先をシステム毎に分けて、システム構築を⾏っている。 強⼀貫性構成

    結果整合性構成 ⼤阪→東京レプリケーション 東京→⼤阪レプリケーション ⼤阪→東京レプリケーション 東京→⼤阪レプリケーション
  27. ©PayPay Corporation 38 ©PayPay Corporation Amazon S3 + Amazon CloudFront

    Origin Groupを構成し、システムの可⽤性を⾼めている ⼤阪→東京レプリケーション 東京→⼤阪レプリケーション
  28. ©PayPay Corporation 41 ©PayPay Corporation 東京<->⼤阪間の双⽅向でレプリケーションを作成 paypay-source-bucket paypay-destination-bucket 東京リージョン ⼤阪リージョン

    ⼤阪→東京レプリケーション 東京→⼤阪レプリケーション Amazon S3 マルチリージョン構成の作り⽅
  29. ©PayPay Corporation 43 ©PayPay Corporation 新規のObjectは、レプリケーションされる paypay-source-bucket 東京リージョン ⼤阪リージョン paypay-destination-bucket

    ⼤阪→東京レプリケーション 東京→⼤阪レプリケーション 1 2 3 3 Amazon S3 マルチリージョン構成の作り⽅
  30. ©PayPay Corporation 44 ©PayPay Corporation 理想は、既存のObjectもレプリケーションされること paypay-source-bucket 東京リージョン ⼤阪リージョン paypay-destination-bucket

    ⼤阪→東京レプリケーション 東京→⼤阪レプリケーション 1 2 3 3 1 2 Amazon S3 マルチリージョン構成の作り⽅
  31. ©PayPay Corporation 45 ©PayPay Corporation 東京<->⼤阪間のレプリケーションを作成 paypay-source-bucket paypay-destination-bucket 東京リージョン ⼤阪リージョン

    ⼤阪→東京レプリケーション 東京→⼤阪レプリケーション Amazon S3 マルチリージョン構成の作り⽅
  32. ©PayPay Corporation 46 ©PayPay Corporation 既存ObjectをレプリケーションさせるBatch Operationsがある paypay-source-bucket paypay-destination-bucket 東京リージョン

    ⼤阪リージョン ⼤阪→東京レプリケーション 東京→⼤阪レプリケーション Batch Operations Amazon S3 マルチリージョン構成の作り⽅
  33. ©PayPay Corporation 47 ©PayPay Corporation このセッションの流れ PayPay概要 01 マルチリージョン構成の課題 02

    マルチリージョン構成でのTips 03 マルチリージョン構成の管理について 04 05 まとめ
  34. ©PayPay Corporation 48 ©PayPay Corporation マルチリージョン構成の管理について - 権限やPolicyなど⼀貫性をもたせるべきものがある - チーム全体でだれでも同じクオリティで作成できる

    - 初回時に忘れちゃいけない設定を漏らさない(レビューしやすい状況を作る) - ⼀⽅で、名前やTag、特殊な設定(ライフサイクル、タイムアウト時間など)ができるように⾃由度を残す リージョン毎のリソース管理を容易におこなうためには︖ PayPayでは、Terraform Moduleで実現
  35. ©PayPay Corporation 49 ©PayPay Corporation マルチリージョン構成の管理について - 個別にリソースを定義せず、 設定や作成したいリソースをテンプレート化して、利⽤できる機能 Terraform

    Module とは︖ 例 : 外部公開したいエンドポイントを作りたい︕ Amazon Route53 + Application Load Balancer + Amazon EC2 構成をエンドポイント名やインスタンス サイズなどを指定するだけでできる
  36. ©PayPay Corporation 50 ©PayPay Corporation マルチリージョン構成の管理について リージョンコードをアプリケーションソースにハードコードするのをやめた - 環境変数からリージョンコードやリソース名を呼び出す -

    環境変数を変えるだけでリージョン毎のアプリのリリースを容易に リソース毎に利⽤⽅法を確認し、アプリケーション側と共通認識を持った - 強⼀貫性が必要、結果整合性で問題ないなど、利⽤⽅法がマルチリージョン対応できるか確認した - IAM Roleで利⽤⽅法毎に制御を⾏いたいので、確認した インフラ以外でアプリケーション側と対応してきたこと
  37. ©PayPay Corporation 51 ©PayPay Corporation マルチリージョン構成の改善したいポイント 同⼀リージョンの場合はセキュリティグループを送信元/送信先として指定できる。 マルチリージョンでのセキュリティグループ 別リージョンの場合はCIDRブロックで指定する必要がある。 AWS

    IAM Identity Center(AWS SSO) 東京リージョンのみでリリースされているサービスの対応 - 東京リージョンなど単⼀リージョンでのみ利⽤可能でレプリケーションなどの機能がない - 別途、独⽴したIAM User管理の基盤を構築し、AWS IAM Identity Centerの利⽤不可に備えている AWS Transfer Family - ⼤阪リージョンでも利⽤できるが、Userはリージョン毎に独⽴のため、それぞれで作成が必須
  38. ©PayPay Corporation 53 ©PayPay Corporation このセッションの流れ PayPay概要 01 マルチリージョン構成の課題 02

    マルチリージョン構成でのTips 03 マルチリージョン構成の管理について 04 05 まとめ
  39. ©PayPay Corporation 55 Diverse & Multinational Professionals From around 50

    countries -World class Engineering Organization-