LoginSignup
7
5

More than 5 years have passed since last update.

Check! AWS Lambda - Execution Role についてまず読んでみた

Last updated at Posted at 2014-12-31

こんにちは、cloudpack@dz_ こと大平かづみです。

Prologue - はじめに

AWS Lambda のドキュメンテーション「How it Works」を読んでいて、Execution Role に関しての項がぱっと読解できなかったので、いったん訳だけして、落とし込んでみることにしました。

AWS Lambda の仕組み - 実行ロール

さて、Component:Execution Role を読みます。

The "execution" role refers to an IAM role that grants your custom code permissions to access AWS resources it needs. AWS Lambda assumes this role while executing Lambda functions on your behalf.

"この '実行' ロールは、あなたが作成したコードにパーミッションを与えるIAMロールを参照します。AWS Lambda が、あなたに代わり、このロールを元にLambdaファンクション(関数)を実行します。"

Each IAM role you create has two policies attached.

"あなたが作るそれぞれの IAM ロールは、2つのポリシーをアタッチすることになります。"

アクセスポリシー

Access policy—This policy grants your function the resource permissions it needs. AWS Lambda writes logs for your function to Amazon CloudWatch, provided you give the permissions as shown in the following example policy. The policy allows permission for all log actions (logs:*) on CloudWatch logs.

"アクセスポリシー - このポリシーは、あなたのファンクション(関数)に必要なリソースへのパーミッションを与えます。AWS Lambda は、あなたのファンクション(関数)のために、後述のサンプルのポリシーで示されるパーミッションを与えたAmazon CloudWatchにログを出力します。このポリシーは、CloudWatch logs 上のすべてのログに関するアクション (logs:*) を許可しています。"

{
    "Statement": [
        {
            "Action": [
                "logs:*"
            ],
            "Effect": "Allow",
            "Resource": "arn:aws:logs:*:*:*"
        }
    ]
}

You add other permissions as needed by your Lambda function. So if your function uploads an object to an Amazon S3 bucket, you grant permission for relevant actions in this policy. For a list of Amazon S3 actions, go to Specifying Permissions in a Policy in Amazon Simple Storage Service Developer Guide.

"あなたは、Lambda ファンクション(関数) が必要とするほかのパーミッションを与えます。それで、もしあなたのファンクション(関数)がAmazon S3バケットにオブジェクトを格納する場合、このポリシーの中に関連するアクションのパーミッションを与えます。Amazon S3のアクションの一覧については、Amazon S3のディベロッパーガイドにある「Specifying Permissions in a Policy」を参照してください。"

トラストポリシー

Trust policy—A trust policy identifies who can assume the role. The following trust policy grants AWS Lambda the permission to assume the role.

"トラストポリシー - トラストポリシーは誰がそのロールを利用できるのかを識別します。後述のトラストポリシーは、AWS Lambda にそのロールを利用するためのパーミッションを与えます。"

重要

Important
The user who is creating the role is passing permission to Lambda to assume this role. The user must have permission for the iam:PassRole action to be able to grant this permission. If an administrator user is creating this role, the user has full permissions including the iam:PassRole.

"ロールを作ったユーザーは、このロールを利用するパーミッションをパスすることができます。このユーザは、このパーミッションを与えることができるように iam:PassRole というアクションのパーミッションを持っています。もし管理者ユーザーがこのロールを作った場合、そのユーザは iam:PassRole を含む全権限を持つことになります。"

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "",
      "Effect": "Allow",
      "Principal": {
        "Service": "lambda.amazonaws.com"
      },
      "Action": "sts:AssumeRole"
    }
  ]
}

For more information about IAM roles, go to Roles (Delegation and Federation) in Using IAM.

"IAMロールに関する詳細情報は、Using IAM の「Roles (Delegation and Federation)」を参照してください。"

Epilogue - おわりに

机上ではやはりしっくりこず…。理解が難しいのは、どうやら IAMロールについての知識が乏しいからのような気がしてきました…orz
このまま、対になる Invocation Role も読んで、実践にて必要になる情報を確かめていこうと考えています。


最近の記事

Check! AWS Lambda を理解しようシリーズ

その他の記事一覧はこちらです。

7
5
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
7
5