LoginSignup
4
2

More than 5 years have passed since last update.

AWS Global Acceleratorを試してみる

Last updated at Posted at 2018-12-18

はじめに

AWS Global Acceleratorが発表になりましたので試してみます。
https://aws.amazon.com/jp/blogs/news/new-aws-global-accelerator/

概要

複数リージョンにアクセス可能な固定エニーキャストアドレスを提供する
クライアントに最も近いAWSエッジロケーションを経由して、アプリケーションにアクセスする
AWS Global Accelerator配下に、ALB/NLB/EIPを登録することが可能

試してみる

ALB配下にLambdaを登録できるようになったのでこちらも合わせて確認したいと思います。
https://aws.amazon.com/jp/blogs/news/lambda-functions-as-targets-for-application-load-balancers/

テスト構成

image.png

バックエンドの準備 ※2リージョンで実施する。今回はTokyoとOregon

Lambda関数を作成する

def lambda_handler(event, context):
    response = {
       "statusCode": 200,
       "statusDescription": "200 OK",
       "isBase64Encoded": False,
       "headers": {
           "Content-Type": "text/html; charset=utf-8"
        }
    }

    response['body'] = """<html>
    <head>
    <title>Hello World!</title>
    <style>
    html, body {
       margin: 0; padding: 0;
       font-family: arial; font-weight: 700; font-size: 3em;
       text-align: center;
    }
    </style>
    </head>
       <body>
          <p>Hello Tokyo or Oregon</p>
      </body>
    </html>"""
    return response

以下のBlog記事より転載
https://aws.amazon.com/jp/blogs/news/lambda-functions-as-targets-for-application-load-balancers/

ALBを作成する
TargetGroupでLambda関数を指定する
image.png

先程作成したLambda関数を指定する
image.png

AWS Global Accelerator作成

Global Acceleratorをクリック
image.png

Create acceleratorをクリック
image.png

image.png

Listenerを登録します
Client affinityは、ソースIPアドレスを元に同じクライアントからのアクセスは、同じエンドポイントにルーティングする機能です
https://docs.aws.amazon.com/ja_jp/global-accelerator/latest/dg/about-listeners-client-affinity.html

image.png

OregonとTokyoにエンドポイントグループを作成する
image.png

エンドポイントを作成する
Add endpointをクリック
image.png

作成してALBを指定する
image.png

2つのIPアドレスが付与される
image.png

接続確認実施

東京のクライアントからアクセス
image.png

オレゴンのクライアントからアクセス
image.png

落ち穂拾い

落ち穂拾いとして、Internet facing/Internal ALBとVPC内/外Lambdaの組み合わせパターンについても確認しました。
こちらは、ALB+lambdaの単体の確認でありAWS Global Acceleratorは前段に置いた構成ではありません。
結論として、以下の全パターンでALB経由でLambdaを実行可能でした。

image.png

お約束

投稿内容は私個人の意見であり、所属企業・部門見解を代表するものではありません。

4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2