To support AmazonMQ connections with pika for Clowder 2, we need some extra SSL pieces that we could enable with a flag:
https://docs.aws.amazon.com/amazon-mq/latest/developer-guide/amazon-mq-rabbitmq-pika.html
def __init__(self, rabbitmq_broker_id, rabbitmq_user, rabbitmq_password, region):
# SSL Context for TLS configuration of Amazon MQ for RabbitMQ
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
ssl_context.set_ciphers('ECDHE+AESGCM:!ECDSA')
url = f"amqps://{rabbitmq_user}:{rabbitmq_password}@{rabbitmq_broker_id}.mq.{region}.amazonaws.com:5671"
parameters = pika.URLParameters(url)
parameters.ssl_options = pika.SSLOptions(context=ssl_context)
self.connection = pika.BlockingConnection(parameters)
self.channel = self.connection.channel()
Note that this example also uses a pika.URLParameters() way to instantiate the params rather than what we currently use. We could just include AWS flags to enable this.
To support AmazonMQ connections with pika for Clowder 2, we need some extra SSL pieces that we could enable with a flag:
https://docs.aws.amazon.com/amazon-mq/latest/developer-guide/amazon-mq-rabbitmq-pika.html
Note that this example also uses a pika.URLParameters() way to instantiate the params rather than what we currently use. We could just include AWS flags to enable this.