Azure Cloud — API 통합 설계 & Cost

AZ-304, AZ-303 Azure Cloud Architect 자격증 준비(7)

SoniaComp
9 min readMar 12, 2021

출처 및 참고

Azure API Management

API Management helps organizations publish APIs to external, partner, and internal developers to unlock the potential of their data and services.

→ Transform API : a new policy

  • The API is available to partners over the internet.
  • The APIM instance can access real-time data from VM1.
  • not VPN Gateway

API 게시 및 관리

  • Azure API Gateway 만들기
  • API를 Gateway로 가져오기
  • 개발자가 액세스할 수 있도록 API 게시
  • 구독 키를 사용하여 API 호출

캐싱 정책을 추가하여 API 성능 향상

Azure API Management에서는 관리자가 정책을 사용하여 구성을 통해 API의 동작을 변경할 수 있습니다. API의 기본 기능과 동작은 코드를 작성하는 개발자가 설계합니다. 그러나 관리자는 정책을 사용하여 한도를 설정하거나, 응답 형식을 변환하거나, 보안 요구 사항을 적용할 수 있습니다. 이 모듈에서는 정책을 사용하여 캐시를 설정하고 제어하는 데 중점을 두겠습니다.

  • 모든 응답을 XML 형식으로 보내도록 하려면 → json-to-xml 정책

API 보호

  • Azure API 게이트에이 만들기
  • RESTful API 를 게이트웨이로 가져오기
  • 요청을 보호하고 제한하는 정책 구현
    → 응답에서 헤더 제거: API 엔드포인트를 통해 노출되는 모든 데이터는 최신 표준을 통해 보안을 유지해야 합니다. 응답 헤더는 응답의 자세한 컨텍스트를 제공하는 HTTP 응답과 연결된 메타데이터입니다. 사용 중인 서버 및 플랫폼 기술에 대한 정보를 노출할 수 있습니다. 모든 응답에서 안전하지 않은 헤더를 제거하는 정책을 적용합니다.
  • 적용된 정책을 테스트하기 위해 API 호출

API 에 대한 인증 제어

Azure APIM(API Management)을 사용하여 조직은 외부 파트너 및 내부 개발자에게 API를 게시함으로써 데이터 및 서비스의 잠재력을 활용할 수 있습니다.
→ 무단 사용으로부터 API를 보호하는 정책 구성, 적용된 정책을 테스트하기 위해 API 호출

  • API 키를 사용하여 API 보호
  • 클라이언트 인증서 인증을 사용하여 API 보호

여러 Azure Function 앱을 일관된 API로 노출

  • 서버리스 애플리케이션에서 Azure API Management의 값 식별
  • Azure API Management 에서 Azure Functions 앱을 API로 가져오기
  • Azure API Management 에서 여러 Azure Functions 앱 가져오기

Azure API Management(APIM)
API Management에 대한 사용량 플랜을 선택할 때는 사용량 계층을 선택할 수 있습니다. 이 계층이 마이크로 서비스 기반 아키텍처 및 이벤트 기반 시스템에 특히 적합하기 때문입니다. 예를 들어, 이 계층은 온라인 스토어 웹 API에 아주 적합합니다.

  • The selected authorization grant type is for → Web Applications
    The Authorization Code Grant Type is used by both web apps and native apps to get an access token after a user authorizes an app. The Authorization Code grant type is used by confidential and public clients to exchange an authorization code for an access token. After the user returns to the client via the redirect URL, the application will get the authorization code from the URL and use it to request an access token.
  • The enable custom data in the grant flow client credentials
    How to include additional client data In case you need to store additional details about a client that don’t fit into the standard parameter set the custom data parameter comes to help:The data parameter permits arbitrary content packaged in a JSON object. To set it you will need the master registration token or a one-time access token with a client-reg:data scope.

APIM 사용량계층
사용량 계층은 이전 계층과 동일한 기본 서비스 구성 요소를 사용하지만 동적으로 할당된 공유 리소스를 기준으로 완전히 다른 아키텍처를 사용합니다. 이 계층은 서버리스 컴퓨팅 모델에 완벽하게 잘 맞습니다. 관리할 인프라가 없고, 유휴 용량이 없는 고가용성, 자동 크기 조정 및 사용량 기반 가격 책정이 제공되므로, 서버리스 리소스를 API로 노출하는 솔루션에 특히 적합합니다.

예제)

The web service allows an API to access real-time data from VM1. You deploy an Azure API Management Service. The relevant API Management configuration is shown in the API ambit.

  • The API is available to partners over the Internet.
  • The APIM instance can access real-time data from VM1.
  • API Gateway is not needed.

예제)

an HTTP-based API to support a web app
→ Implement Azure Functions
→ provide public read-only operations
→ do not allow wirte operations
→ public read-only operations

  • authentication methods: GET only
  • Authorization level: anonymous
    This option turns on authentication and authorization in App Service, but defers authorization decisions to your application code. For authenticated requests, App Service also passes along authentication information in the HTTP headers. This option provides more flexibility in handling anonymous requests.

Cost

create a resources group for each resource type. Assign tags to each resource
→ Tags enable you to retrieve related resources from different resource groups. This approach is helpful when you need to organize resources for billing or management.

# Cron이란 무엇인가
Cron은 간단한게 말해서 unix 운영체제에서 어떤 작업을 특정 시간에 실행시키기 위한 데몬이다. 예를 들어 하루에 한차례 특정 서버에 접속해서 데이터를 받아와야 한다든지, 아니면 새벽 3시에 특정 작업을 수행할 필요가 있다던지, 이런 식으로 일정한 시간 간격으로 수행되어야 할 작업이나 사용자가 그시간에 작업을 할 수 없는 상황일때, 서버는 항상 돌아가고 있다는 점을 십분 이용하는 아주 유용한 방법이라 할 수 있겠다.

# .Net Core Runtime은 open-source community에 릴리즈되었으며 .NET 팀과 함께 플렛폼을 개선하고 확장할 수 있습니다. MIT Open Source 라이센스로서 제공되며 Server, Cloud Application을 제작하는데 있어 필요한 오픈소스 크로스플렛폼 .NET 환경을 제공합니다. .NET Core는 컴파일러와 CLR 뿐만 아니라 .NET Base Class 라이브러리, 상위레벨 .NET Web, Data, API Framework까지도 오픈소스로 제공합니다. 출처: https://nsinc.tistory.com/164 [NakedStrength]

예제) All Azure resources must be easily identifiable based on the following operational information environment, owner, department and cost center You need 10 ensure that you can use the operational information when you generate reports for the Azure resources. → an Azure policy that enforces tagging rules

--

--

SoniaComp
SoniaComp

Written by SoniaComp

Data Engineer interested in Data Infrastructure Powering Fintech Innovation (https://www.linkedin.com/in/sonia-comp/)

No responses yet