자습서: REST API ConnectionType 및 연결 생성
Foo REST API에 연결
AWS Glue REST API ConnectionType과 Foo REST API에 대한 해당 AWS Glue 연결을 생성합니다. 이 API에는 다음과 같은 속성이 있습니다(REST API 설명서에서 검색할 수 있음).
-
인스턴스 URL: https://foo.cloud.com/rest/v1.
-
인증 유형: OAuth2(클라이언트 자격 증명).
-
REST 메서드: GET.
-
페이지 매김 유형: 요청의 쿼리 파라미터에 속성 “제한” 및 “오프셋”이 배치된 오프셋입니다.
-
지원되는 엔터티:
-
Bar: 상대 경로 [/bar.json].
-
Baz: 상대 경로 [/baz.json].
-
모든 세부 정보를 가져오면 Foo REST API에 대한 AWS Glue 연결 생성을 시작할 수 있습니다.
REST API 연결을 생성하려면:
-
AWS API, CLI 또는 SDK를 사용하여 RegisterConnectionType API를 호출하여 AWS Glue에서 REST API 연결 유형을 생성합니다. 그러면 AWS Glue에 새 ConnectionType 리소스가 생성됩니다.
{ "ConnectionType": "REST-FOO-CONNECTOR", "IntegrationType": "REST", "Description": "AWS Glue Connection Type for the FOO REST API", "ConnectionProperties": { "Url": { "Name": "Url", "Required": true, "DefaultValue": "https://foo.cloud.com/rest/v1", "PropertyType": "USER_INPUT" } }, "ConnectorAuthenticationConfiguration": { "AuthenticationTypes": ["OAUTH2"], "OAuth2Properties": { "OAuth2GrantType": "CLIENT_CREDENTIALS" } }, "RestConfiguration": { "GlobalSourceConfiguration": { "RequestMethod": "GET", "ResponseConfiguration": { "ResultPath": "$.result", "ErrorPath": "$.error.message" }, "PaginationConfiguration": { "OffsetConfiguration": { "OffsetParameter": { "Key": "offset", "PropertyLocation": "QUERY_PARAM" }, "LimitParameter": { "Key": "limit", "PropertyLocation": "QUERY_PARAM", "DefaultValue": "50" } } } }, "ValidationEndpointConfiguration": { "RequestMethod": "GET", "RequestPath": "/bar.json?offset=1&limit=10" }, "EntityConfigurations": { "bar": { "SourceConfiguration": { "RequestMethod": "GET", "RequestPath": "/bar.json", "ResponseConfiguration": { "ResultPath": "$.result", "ErrorPath": "$.error.message" } }, "Schema": { "name": { "Name": "name", "FieldDataType": "STRING" }, "description": { "Name": "description", "FieldDataType": "STRING" }, "id": { "Name": "id", "FieldDataType": "STRING" }, "status": { "Name": "status", "FieldDataType": "STRING" } } } } } } -
AWS Secrets Manager에서 보안 암호를 생성합니다. 보안 암호에는
USER_MANAGED_CLIENT_APPLICATION_CLIENT_SECRET를 키로 사용하여 연결된 앱 소비자 보안 암호가 포함되어야 합니다.참고
AWS Glue에서 연결당 보안 암호를 생성해야 합니다.
-
AWS API, CLI 또는 SDK를 사용하여 CreateConnection API를 호출하여 AWS Glue 연결을 생성합니다.
-
1단계의 REST 연결 유형 이름을 “ConnectionType”으로 참조합니다.
-
AWS Glue ConnectionType 등록 프로세스 중에 정의된 InstanceUrl 및 기타 ConnectionProperties를 제공합니다.
-
구성된 인증 유형 중에서 선택합니다. REST API Foo는 ClientCredentials 권한 부여 유형과 함께 OAuth2를 사용합니다.
-
구성된 SecretArn 및 기타 AuthenticationProperties를 제공합니다. 예를 들어
OAUTH2를 AuthenticationType으로 구성했으므로 CreateConnectionInput에서 “OAuth2Properties”를 설정합니다. 이렇게 하려면 “OAuth2GrantType”, “TokenUrl” 및 “OAuth2ClientApplication”과 같은 속성이 필요합니다.
-
-
CreateConnection을 요청하여 AWS Glue 연결을 생성합니다.
{ "ConnectionInput": { "Name": "ConnectionFooREST", "ConnectionType": "REST-FOO-CONNECTOR", "ConnectionProperties": {}, "ValidateCredentials": true, "AuthenticationConfiguration": { "AuthenticationType": "OAUTH2", "SecretArn": "arn:aws:secretsmanager:<region>:<accountId>:secret:<secretId>", "OAuth2Properties": { "OAuth2GrantType": "CLIENT_CREDENTIALS", "TokenUrl": "https://foo.cloud.com/oauth/token", "OAuth2ClientApplication": { "UserManagedClientApplicationClientId": "your-managed-client-id" } } } } }