last): File "/Users/yusuku_shimizu/git/codecommit/shimi zu-chatgpt/app.py", line 1, in <module> from aws_cdk import core ImportError: cannot import name 'core' from 'aws_cdk' (/Users/yusuku_shimizu/git/codecommit/shimiz u-chatgpt/.venv/lib/python3.9/site- packages/aws_cdk/__init__.py) Subprocess exited with error 1 core のインポートが出来ない OUTPUT4 RESULT ChatGPT 、OpenAI 、https://openai.com/blog/chatgpt 、アクセス日:2023/03/28
AwsSolutions- IAM4[Policy::arn: <AWS::Partition>:iam::aws:policy/service- role/AWSLambdaBasicExecutionRole]: The IAM user, role, or group uses AWS managed policies. [Error at /ServerlessEventBridgeExample/HelloChatGPTLa mbda/Resource] AwsSolutions-L1: The non- container Lambda function is not configured to use the latest runtime version. Found errors cdk-nag 指摘内容 IAM のマネージドポリシーを使ってる 最新のRuntime を利用していない
・指摘内容 [Error at /ServerlessEventBridgeExample/HelloChatGPTLambda/ServiceRol e/Resource] AwsSolutions-IAM4[Policy::arn: <AWS::Partition>:iam::aws:policy/service- role/AWSLambdaBasicExecutionRole]: The IAM user, role, or group uses AWS managed policies. [Error at /ServerlessEventBridgeExample/HelloChatGPTLambda/Resource] AwsSolutions-L1: The non-container Lambda function is not configured to use the latest runtime version. $ cdk diff ... hello_chatgpt_lambda.role = lambda_role AttributeError: can't set attribute Subprocess exited with error 1 修正内容(from ChatGPT) 修正結果 Lambda 関数のランタイムをPython 3.9 に更新し ました ( 行 21) 。 AWS マネージドポリシーの代わりに、カスタム ポリシーを作成し、Lambda 関数に関連付けられ たロールにアタッチしました ( 行 25-45) 。 変更点: 1. 2.