簡體   English   中英

Terraform:驗證錯誤......成員必須滿足正則表達式模式:arn:aws:iam::

[英]Terraform: Validation error ... Member must satisfy regular expression pattern: arn:aws:iam::

我正在嘗試通過 kinesis 數據流傳輸 rds,但它給了我這個錯誤:

botocore.exceptions.ClientError:調用 PutRecord 操作時發生錯誤 (ValidationException):檢測到 1 個驗證錯誤:值 'arn:aws:kinesis:us-west-2:xxxxxxxxxx:stream/rds-temp-leads-stream' at 'streamName' 未能滿足約束:成員必須滿足正則表達式模式:[a-zA-Z0-9_.-]+

我能做些什么來解決這個問題?


import json
import boto3
from datetime import datetime

from pymysqlreplication import BinLogStreamReader
from pymysqlreplication.row_event import (
  DeleteRowsEvent,
  UpdateRowsEvent,
  WriteRowsEvent,
)

class DateTimeEncoder(json.JSONEncoder):
    def default(self, o):
        if isinstance(o, datetime):
            return o.isoformat()

        return json.JSONEncoder.default(self, o)

def main():
  mysql = {
      "host": "",
      "port":,
      "user": "",
      "passwd": "",
      "db": ""}
  kinesis = boto3.client("kinesis", region_name = 'us-west-2')

  stream = BinLogStreamReader(
    connection_settings = mysql,
    server_id=100,
    blocking = True,
    log_file='mysql-bin.000003',
    resume_stream=True,
    only_events=[DeleteRowsEvent, WriteRowsEvent, UpdateRowsEvent]) 
  for binlogevent in stream:
    for row in binlogevent.rows:
      print row
      event = {"schema": binlogevent.schema,
      "table": binlogevent.table,
      "type": type(binlogevent).__name__,
      "row": row
      }

      kinesis.put_record(StreamName="jhgjh", Data=json.dumps(event, cls=DateTimeEncoder), PartitionKey="default")
      #print json.dumps(event)

if __name__ == "__main__":
   main()

我正在嘗試通過運動學數據流流rds,但這給了我這個錯誤:

botocore.exceptions.ClientError:調用PutRecord操作時發生錯誤(ValidationException):檢測到1個驗證錯誤:值'arn:aws:kinesis:us-west-2:xxxxxxxxxx:stream / rds-temp-leads-stream位於'streamName'無法滿足約束:成員必須滿足正則表達式模式:[a-zA-Z0-9 _.-] +

我該怎么做才能解決此問題?


import json
import boto3
from datetime import datetime

from pymysqlreplication import BinLogStreamReader
from pymysqlreplication.row_event import (
  DeleteRowsEvent,
  UpdateRowsEvent,
  WriteRowsEvent,
)

class DateTimeEncoder(json.JSONEncoder):
    def default(self, o):
        if isinstance(o, datetime):
            return o.isoformat()

        return json.JSONEncoder.default(self, o)

def main():
  mysql = {
      "host": "",
      "port":,
      "user": "",
      "passwd": "",
      "db": ""}
  kinesis = boto3.client("kinesis", region_name = 'us-west-2')

  stream = BinLogStreamReader(
    connection_settings = mysql,
    server_id=100,
    blocking = True,
    log_file='mysql-bin.000003',
    resume_stream=True,
    only_events=[DeleteRowsEvent, WriteRowsEvent, UpdateRowsEvent]) 
  for binlogevent in stream:
    for row in binlogevent.rows:
      print row
      event = {"schema": binlogevent.schema,
      "table": binlogevent.table,
      "type": type(binlogevent).__name__,
      "row": row
      }

      kinesis.put_record(StreamName="jhgjh", Data=json.dumps(event, cls=DateTimeEncoder), PartitionKey="default")
      #print json.dumps(event)

if __name__ == "__main__":
   main()

我正在嘗試通過運動學數據流流rds,但這給了我這個錯誤:

botocore.exceptions.ClientError:調用PutRecord操作時發生錯誤(ValidationException):檢測到1個驗證錯誤:值'arn:aws:kinesis:us-west-2:xxxxxxxxxx:stream / rds-temp-leads-stream位於'streamName'無法滿足約束:成員必須滿足正則表達式模式:[a-zA-Z0-9 _.-] +

我該怎么做才能解決此問題?


import json
import boto3
from datetime import datetime

from pymysqlreplication import BinLogStreamReader
from pymysqlreplication.row_event import (
  DeleteRowsEvent,
  UpdateRowsEvent,
  WriteRowsEvent,
)

class DateTimeEncoder(json.JSONEncoder):
    def default(self, o):
        if isinstance(o, datetime):
            return o.isoformat()

        return json.JSONEncoder.default(self, o)

def main():
  mysql = {
      "host": "",
      "port":,
      "user": "",
      "passwd": "",
      "db": ""}
  kinesis = boto3.client("kinesis", region_name = 'us-west-2')

  stream = BinLogStreamReader(
    connection_settings = mysql,
    server_id=100,
    blocking = True,
    log_file='mysql-bin.000003',
    resume_stream=True,
    only_events=[DeleteRowsEvent, WriteRowsEvent, UpdateRowsEvent]) 
  for binlogevent in stream:
    for row in binlogevent.rows:
      print row
      event = {"schema": binlogevent.schema,
      "table": binlogevent.table,
      "type": type(binlogevent).__name__,
      "row": row
      }

      kinesis.put_record(StreamName="jhgjh", Data=json.dumps(event, cls=DateTimeEncoder), PartitionKey="default")
      #print json.dumps(event)

if __name__ == "__main__":
   main()

就我而言,我還必須刪除地址中的子文件夾,如下所示:

不正確

bucket='s3://image-video/image/'
photo='scene_academy.jpg'

client=boto3.client('rekognition')
response = client.detect_labels(Image={'S3Object':{'Bucket':bucket,'Name':photo}},
        MaxLabels=10)

正確的

bucket='image-video'
photo='image/scene_academy.jpg'

client=boto3.client('rekognition')
response = client.detect_labels(Image={'S3Object':{'Bucket':bucket,'Name':photo}},
        MaxLabels=10)

運行時環境:AWS S3 存儲桶

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM