RabbitMQ용 Amazon MQ에 HTTP 인증 및 권한 부여 사용 - Amazon MQ

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

RabbitMQ용 Amazon MQ에 HTTP 인증 및 권한 부여 사용

이 자습서에서는 외부 HTTP 서버를 사용하여 RabbitMQ용 Amazon MQ 브로커에 대한 HTTP 인증 및 권한 부여를 구성하는 방법을 설명합니다.

참고

HTTP 인증 플러그인은 RabbitMQ용 Amazon MQ 버전 4 이상에서만 사용할 수 있습니다. RabbitMQ

HTTP 인증 및 권한 부여를 구성하기 위한 사전 조건

AWS RabbitMQ용 Amazon MQ HTTP 인증 통합을 위한 CDK 스택을 배포하여이 자습서에 필요한 AWS 리소스를 설정할 수 있습니다.

이 CDK 스택은 HTTP 인증 서버, 인증서 및 IAM 역할을 포함하여 필요한 모든 AWS 리소스를 자동으로 생성합니다. 스택에서 생성한 리소스의 전체 목록은 패키지 README를 참조하세요.

CDK 스택을 사용하는 대신 리소스를 수동으로 설정하는 경우 RabbitMQ용 Amazon MQ 브로커에 HTTP 인증을 구성하기 전에 동등한 인프라가 있는지 확인합니다.

Amazon MQ를 설정하기 위한 사전 조건

AWS CLI 버전 >= 2.28.23: 브로커 생성 중에 사용자 이름과 암호를 선택적으로 추가할 수 있습니다.

AWS CLI를 사용하여 RabbitMQ에서 HTTP 인증 구성

이 절차에서는 AWS CLI를 사용하여 필요한 리소스를 생성하고 구성합니다. 다음 절차에서는 자리 표시자 값을 실제 값으로 바꿔야 합니다.

  1. 다음 예제와 같이 create-configuration AWS CLI 명령을 사용하여 새 구성을 생성합니다.

    aws mq create-configuration \ --name "rabbitmq-http-config" \ --engine-type "RABBITMQ" \ --engine-version "4.2"

    이 명령은 다음 예제와 유사한 응답을 반환합니다.

    { "Arn": "arn:aws:mq:us-west-2:123456789012:configuration:c-fa3390a5-7e01-4559-ae0c-eb15b38b22ca", "AuthenticationStrategy": "simple", "Created": "2025-07-17T16:03:01.759943+00:00", "Id": "c-fa3390a5-7e01-4559-ae0c-eb15b38b22ca", "LatestRevision": { "Created": "2025-07-17T16:03:01.759000+00:00", "Description": "Auto-generated default for rabbitmq-http-config on RabbitMQ 4.2", "Revision": 1 }, "Name": "rabbitmq-http-config" }
  2. 다음 예제와 같이 HTTP를 인증 및 권한 부여 방법으로 rabbitmq.conf 사용하도록 라는 구성 파일을 생성합니다. 템플릿의 모든 자리 표시자 값(로 표시됨${...})을 배포된 AWS CDK 사전 조건 스택 출력 또는 이에 상응하는 인프라의 실제 값으로 바꿉니다.

    auth_backends.1 = cache auth_backends.2 = http auth_cache.cached_backend = http # HTTP authentication settings # For more information, see https://github.com/rabbitmq/rabbitmq-auth-backend-http # FIXME: Replace the ${...} placeholders with actual values # from your deployed prerequisite CDK stack outputs. auth_http.http_method = post auth_http.user_path = ${HttpServerUserPath} auth_http.vhost_path = ${HttpServerVhostPath} auth_http.resource_path = ${HttpServerResourcePath} auth_http.topic_path = ${HttpServerTopicPath} # TLS/HTTPS configuration auth_http.ssl_options.verify = verify_peer auth_http.ssl_options.sni = test.amazonaws.com # AWS integration for secure credential retrieval # For more information, see https://github.com/amazon-mq/rabbitmq-aws # Replace the ${...} placeholders with actual ARN values # from your deployed prerequisite CDK stack outputs. aws.arns.assume_role_arn = ${AmazonMqAssumeRoleArn} aws.arns.auth_http.ssl_options.cacertfile = ${CaCertArn}
  3. update-configuration AWS CLI 명령을 사용하여 구성을 업데이트합니다. 3단계의 구성 ID를 사용합니다.

    aws mq update-configuration \ --configuration-id "<c-fa3390a5-7e01-4559-ae0c-eb15b38b22ca>" \ --data "$(cat rabbitmq.conf | base64 --wrap=0)"

    이 명령은 다음 예제와 유사한 응답을 반환합니다.

    { "Arn": "arn:aws:mq:us-west-2:123456789012:configuration:c-fa3390a5-7e01-4559-ae0c-eb15b38b22ca", "Created": "2025-07-17T16:57:04.520931+00:00", "Id": "c-fa3390a5-7e01-4559-ae0c-eb15b38b22ca", "LatestRevision": { "Created": "2025-07-17T16:57:39.172000+00:00", "Revision": 2 }, "Name": "rabbitmq-http-config", "Warnings": [] }
  4. HTTP 구성을 사용하여 브로커를 생성합니다. 이전 단계의 구성 ID와 개정 번호를 사용합니다.

    aws mq create-broker \ --broker-name "rabbitmq-http-test-1" \ --engine-type "RABBITMQ" \ --engine-version "4.2" \ --host-instance-type "mq.m7g.large" \ --deployment-mode "SINGLE_INSTANCE" \ --logs '{"General": true}' \ --publicly-accessible \ --configuration '{"Id": "<c-fa3390a5-7e01-4559-ae0c-eb15b38b22ca>","Revision": <2>}'

    이 명령은 다음 예제와 유사한 응답을 반환합니다.

    { "BrokerArn": "arn:aws:mq:us-west-2:123456789012:broker:rabbitmq-http-test-1:b-2a1b5133-a10c-49d2-879b-8c176c34cf73", "BrokerId": "b-2a1b5133-a10c-49d2-879b-8c176c34cf73" }
  5. describe-broker AWS CLI 명령을 RUNNING사용하여 브로커의 상태가에서 CREATION_IN_PROGRESS로 전환되는지 확인합니다.

    aws mq describe-broker \ --broker-id "<b-2a1b5133-a10c-49d2-879b-8c176c34cf73>"

    이 명령은 다음 예제와 유사한 응답을 반환합니다. config_managed 인증 전략은 브로커가 HTTP 인증 방법을 사용함을 나타냅니다.

    { "AuthenticationStrategy": "config_managed", ..., "BrokerState": "RUNNING", ... }
  6. 필수 CDK 스택에서 생성한 테스트 사용자 중 하나를 사용하여 RabbitMQ 액세스 검증

    # FIXME: Replace ${RabbitMqHttpAuthElbStack.ConsoleUserPasswordArn} with the actual ARN from your deployed prerequisite CDK stack outputs CONSOLE_PASSWORD=$(aws secretsmanager get-secret-value \ --secret-id ${RabbitMqHttpAuthElbStack.ConsoleUserPasswordArn} \ --query 'SecretString' --output text) # FIXME: Replace BrokerConsoleURL with the actual ConsoleURL retrieved by # calling describe-broker for the broker created above # Call management API /api/overview (should succeed) curl -u RabbitMqConsoleUser:$CONSOLE_PASSWORD \ https://${BrokerConsoleURL}/api/overview # Try to create a vhost (should fail - console user only has management permissions) curl -u RabbitMqConsoleUser:$CONSOLE_PASSWORD \ -X PUT https://${BrokerConsoleURL}/api/vhosts/test-vhost \ -H "Content-Type: application/json" \ -d '{}'