たまにPlaywrightをLambdaで動かしたくなりますよね。 すでにいろいろな方が挑戦されているようで、簡単に使えるLambdaレイヤーが公開されているようです。 ただ、そういうことじゃないんです。自分でやることに意味があるんです。なんとか動作しましたので、ご紹介。 きっかけ 先日投稿したこちらの記事で、LangChainの「AsyncChromiumLoader」を紹介しました。 これをLambda化したいなぁと思ったのがきっかけです。(そしてBedrock Agentsから呼び出したい) AsyncChromiumLoaderは内部でPlaywrightが使われているのですが、先ほど解説した「chromium.launch」の呼び出し部分のargsを外部から指定する方法がなかったので、素のPlaywrightを使って検証しました。 Lambda化ができたので、あとはBedrock