-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ランダムでLGTM画像を返すAPIに必要なLambdaの変更を行う #57
Conversation
statement { | ||
effect = "Allow" | ||
actions = [ | ||
"logs:CreateLogGroup", | ||
"logs:CreateLogStream", | ||
"logs:PutLogEvents" | ||
] | ||
resources = [ | ||
"arn:aws:logs:*:*:*" | ||
] | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AWSLambdaVPCAccessExecutionRole に含まれているため削除
@@ -7,6 +7,8 @@ module "lambda" { | |||
log_retention_in_days = local.log_retention_in_days | |||
s3_bucket_name = data.terraform_remote_state.images.outputs.upload_images_bucket_name | |||
lgtm_images_cdn_domain = data.terraform_remote_state.images.outputs.lgtm_images_cdn_domain | |||
vpc_id = data.terraform_remote_state.network.outputs.vpc_id | |||
subnet_ids = data.terraform_remote_state.network.outputs.subnet_public_ids |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private subnet は構築していないので、public subnet に Lambda を構築
|
||
resource "aws_iam_role_policy_attachment" "lambda_api_vpc_access_execution" { | ||
role = aws_iam_role.lambda_api.name | ||
policy_arn = "arn:aws:iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lambda がネットワークインターフェイスを作成および管理をできるように、実行ロールに AWSLambdaVPCAccessExecutionRole
を追加
参考:https://docs.aws.amazon.com/ja_jp/lambda/latest/dg/configuration-vpc.html#vpc-permissions
aacbd9e
to
b819075
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issueURL
#56
Doneの定義
#56 の完了条件が満たされていること
変更点概要
API Lambda から RDS と S3 にアクセスできるよう下記の変更を行なった
NAT gateway は構築していないので、VPC エンドポイントを利用して S3 にアクセスする
参考:VPC の Lambda 関数へのインターネットアクセスを許可する