lacti / lacti.github.io

My blog on GitHub Pages
https://lacti.github.io/
3 stars 2 forks source link

API Gateway의 인증을 위한 Custom Authroizer 사용하기 #3

Open utterances-bot opened 4 years ago

utterances-bot commented 4 years ago

API Gateway의 인증을 위한 Custom Authroizer 사용하기

API Gateway와 Lambda Proxy를 사용하여 간단한 HTTP/s API나 WebSocket API를 구축할 수 있다. AWS CloudFormation을 직접 사용하여 서비스를 구성할 수도 있고, 최근에 나온 aws-cdk…

https://lacti.github.io/2019/08/01/api-gateway-custom-authorizer/?utterances=eb68e08bdfd40347c953922423cea53912795ca2

heejongahn commented 4 years ago

많은 도움이 되었습니다. 감사합니다~!

leewoooo commented 2 years ago

안녕하세요 좋은 글 감사합니다. 혹시 auth lambda를 따로 배포하고 여러 lambda에서 가져다 쓸 수 있는 방법이 있을까요?

lacti commented 2 years ago

@leewoooo

안녕하세요! 해당 글에 관심 가져주셔서 감사합니다 ( )

auth lambda를 따로 배포

Custom Lambda Authorizer로 사용할 Lambda가 현재 stack 바깥에 위치한다는 말씀으로 이해했습니다. Serverless Framework의 공식 문서에 따르면, 그 경우 authorizer에 연결할 Lambda의 ARN을 입력하면 된다고 합니다.

If the Authorizer function does not exist in your service but exists in AWS, you can provide the ARN of the Lambda function instead of the function name, as shown in the following example:

functions:
  create:
    handler: posts.create
    events:
      - http:
          path: posts/create
          method: post
          authorizer: xxx:xxx:Lambda-Name

별도의 AWS 계정에 위치할 경우 managedExternally 옵션을 추가해야 한다고 합니다. 보다 자세한 예제에 대해서는 공식 문서를 참고하시면 더 도움이 될 것 같습니다.

감사합니다! :bow: