我尝试使用 S3Control 通过 boto3 创建 S3 Batch(不是 AWS Batch,这是 S3 Batch 操作)作业,但我收到“无效请求”响应。我通过控制台通过 AWS S3 批处理操作进行了尝试,但现在我尝试通过 boto3 创建批处理作业。附件是代码和错误消息。
\nimport json\nimport boto3\nimport time\nimport datetime\nimport os\ns3ControlClient = boto3.client('s3control')\ndef lambda_handler(event, context):\n accountId = boto3.client('sts').get_caller_identity().get('Account')\n print(accountId)\n response = s3ControlClient.create_job(\n AccountId = accountId,\n ConfirmationRequired = False,\n Operation = {\n 'S3PutObjectRetention': {\n 'BypassGovernanceRetention': False,\n 'Retention': {\n 'RetainUntilDate' : datetime.datetime(2050, 06, 03),\n 'Mode' : 'GOVERNANCE'\n }\n }\n },\n Report={\n 'Bucket' : 'arn:aws:s3:::test-s3-inventory',\n 'Format' : 'Report_CSV_20180820',\n 'Enabled' : True,\n #'Prefix' : time.strftime('%Y%m%d'),\n 'Prefix' : 'report',\n 'ReportScope' : 'AllTasks'\n …Run Code Online (Sandbox Code Playgroud)