Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/357.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 连接到Kinesis的不同AWS帐户并从MQ放入记录_Python_Boto3_Amazon Kinesis - Fatal编程技术网

Python 连接到Kinesis的不同AWS帐户并从MQ放入记录

Python 连接到Kinesis的不同AWS帐户并从MQ放入记录,python,boto3,amazon-kinesis,Python,Boto3,Amazon Kinesis,我有下面的代码,它应该连接到不同的AWS Kinesis帐户,并从AWS MQ中放入记录 import time import boto3 import json from boto3 import Session lambda_client = boto3.client('lambda') kinesis_client = boto3.client('kinesis') def lambda_handler(event, context): session = boto3.sess

我有下面的代码,它应该连接到不同的AWS Kinesis帐户,并从AWS MQ中放入记录

import time
import boto3
import json
from boto3 import Session

lambda_client = boto3.client('lambda')
kinesis_client = boto3.client('kinesis')

def lambda_handler(event, context):
    session = boto3.session.Session(aws_access_key_id= '', aws_secret_access_key= '',region_name='eu-aaa-1')
    kinesis_client = session.client('kinesis')
    print('received a message in worker : "%s"' % event)
    kinesis_client.put_record(
            StreamName='Stream_bookings',
            Data='event',
            PartitionKey='1'
        )
错误日志:-

{
  "errorMessage": "An error occurred (AccessDeniedException) when calling the PutRecord operation: User: arn:aws:iam::349928753634:user/svc.caspian-ingestion.onepurchase-uki-bookings-kinesis-test is not authorized to perform: kinesis:PutRecord on resource: arn:aws:kinesis:eu-central-1:349928753634:stream/CaspianStream_Onepurchase_UKI_bookings",
  "errorType": "ClientError",
  "stackTrace": [
    [
      "/var/task/op_worker.py",
      17,
      "lambda_handler",
我的政策:-

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "kinesis:PutRecord",
                "lambda:InvokeAsync",
                "lambda:InvokeFunction"
            ],
            "Resource": [
                "arn:aws:kinesis:eu-central-1:1234566789:stream/Stream_bookings"
            ]
        }
    ]
}
我们是否有可能在会话下传递Arn详细信息并发送记录