0
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.

最速でAWS CDK + Lambda Function URLs をやっていく

0
Last updated at Posted at 2022-04-07

2022年4月23日現在 CDK(v2.21.0) の Lambda Function で Lambda Function URLs を設定することができるようになりました。

tl; dr

const { HttpMethod } = require('aws-cdk-lib/aws-lambda');
const lambda   = require('aws-cdk-lib/aws-lambda')

      // function に対して addFunctionUrl をやる
      const furl = func.addFunctionUrl({
        authType: lambda.FunctionUrlAuthType.NONE,
        // cors はなんかちゃんと設定したい人がちゃんとしたのを入れてください
        cors:{
          allowedOrigins: ['*'],
          allowedMethods: [HttpMethod.ALL],
          allowedHeaders: ['*'],
        }
      }) 

      // addFunctionUrl の戻り値に対して url で見たところに URL が格納されているのでこれを使おう
      const theURLString = furl.url

以下過去の内容

でも Terraform のが早かった

発表されてから 2w 過ぎようとしてるのに何もできない一方で Terraform の方では

ちゃんと latest で追加されているように見えるので、枯れてない機能を即使っていこうという姿勢としては AWS の CDK よりも Terraform の方が IaC に最適なのかも知れません。

issue

がんばれー

(自力で)やってるひと

感想

You can start configuring Lambda Function URLs directly in your IaC templates today using AWS CloudFormation, AWS SAM, and AWS Cloud Development Kit (AWS CDK).

あと数時間で実装ができれば today っぽいけど無理だった

0
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
0
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?