1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

TerraformでLambdaを作成したときにログがでない

Last updated at Posted at 2021-07-06

TerraformでLambdaを作成したときにログがでない(ロググループがない)

TerraformでLambda作成するときに以下を参考にして権限をつけると大丈夫なようです。
https://aws.amazon.com/jp/premiumsupport/knowledge-center/lambda-cloudwatch-log-streams-error/

今までTerraformでロググループを作っていましたが、権限つければいいじゃんということで備忘です。

CloudWatch にログを書き込む Lambda 関数に必要なアクセス許可を含む JSON ポリシーの例

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "logs:CreateLogGroup",
            "Resource": "arn:aws:logs:region:accountId:*"
        },
        {
            "Effect": "Allow",
            "Action": [
                "logs:CreateLogStream",
                "logs:PutLogEvents"
            ],
            "Resource": [
                "arn:aws:logs:region:accountId:log-group:/aws/lambda/functionName:*"
            ]
        }
    ]
}
1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?