python - Lambda 函数不调用 cloudtrail 日志
问题描述
我正在开发一个 python 脚本,它将使用 lambda 函数在 dynamodb 表中存储 JSON 属性,例如 ("region","ebs_volume_size","instance_type")。这是我的 lambda 函数,它从我的 python 函数中获取策略的输入:
import boto3
import time
import json
import meta_templates
from jinja2 import Template
from template_utils import create_aws_iam_policy_template
dynamodb = boto3.resource('dynamodb')
lambd = boto3.client('lambda')
def lambda_handler(event, context):
template_json = create_aws_iam_policy_template(**event)
table = dynamodb.Table('GoodTable')
response = table.put_item(
Item= {
'Content': 'Volume Size',
'Details': template_json.get('ebs_volume_size'),
}
)
response = table.put_item(
Item= {
'Content': 'Instance Type',
'Details': template_json.get('instance_type'),
}
)
response = table.put_item(
Item= {
'Content': 'Region',
'Details': template_json.get('region'),
}
)
我已授予我的 IAM 角色 DynamoDB 完全访问权限并创建了名为“GoodTable”的 DynamoDB 表,在我运行此函数后,我无法向 DyanmoDB 表添加任何内容,并且该函数运行也没有任何错误。我不确定可能出了什么问题。
解决方案
推荐阅读
- python - 当用户单击“PDF”按钮时,如何将 Django 网页下载到包含所有 css 的 PDF 中?(它的外观,PDF)
- javascript - 在 HTML/JavaScript 中将复选框值分配给布尔值时遇到问题
- reactjs - GrapesJs:无法正确呈现带有脚本的存储组件
- javascript - javascript脚本无法将类列表添加到元素
- python - 将 pyspark 数据帧转换为 json 文件
- javascript - 是否可以在获取请求中全局包含标头?
- python - pyodbc cursor.columns() 内置操作的错误参数类型
- python - 如何在 django-channels 中使用多个路由文件?
- python - 为什么我的集合仍然有重复值?
- reactjs - 使用 Github Pages 部署 React 应用程序但导致空白加载屏幕