기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.
ResourceReference
AWS::Serverless::Connector 리소스 유형이 사용하는 리소스에 대한 참조.
참고
동일한 템플릿에 있는 리소스의 경우 Id
를 제공하십시오. 동일한 템플릿에 있지 않은 리소스의 경우 다른 속성을 조합하여 사용합니다. 자세한 내용은을 참조하십시오AWS SAM 커넥터 참조
구문
AWS Serverless Application Model (AWS SAM) 템플릿에서 이 엔티티를 선언하려면 다음 구문을 사용하십시오.
YAML
Arn:
String
Id:String
Name:String
Qualifier:String
QueueUrl:String
ResourceId:String
RoleName:String
Type:String
속성
-
Arn
-
리소스의 ARN.
타입: 문자열
필수 항목 여부: 조건부
AWS CloudFormation 호환성: 이 속성은 AWS SAM 고유하며 AWS CloudFormation 이에 상응하는 속성이 없습니다.
-
Id
-
동일한 템플릿에 있는 리소스의 논리적 ID.
참고
를 지정하면 커넥터가 AWS Identity and Access Management (IAM) 정책을 생성하면 해당 정책에 연결된 IAM 역할이 리소스에서 유추됩니다.
Id
Id
Id
이 지정되지 않은 경우, 커넥터가 생성된 IAM 정책을 IAM 역할에 연결할 수 있도록 리소스의RoleName
를 제공하십시오.타입: 문자열
필수 항목 여부: 조건부
AWS CloudFormation 호환성: 이 속성은 AWS SAM 고유하며 이에 상응하는 속성이 없습니다. AWS CloudFormation
-
Name
-
리소스의 이름.
타입: 문자열
필수 항목 여부: 조건부
AWS CloudFormation 호환성: 이 속성은 AWS SAM 고유하며 AWS CloudFormation 이에 상응하는 속성이 없습니다.
-
Qualifier
-
범위를 좁히는 리소스의 한정자입니다.
Qualifier
는 리소스 제약 조건 ARN의 끝에 있는*
값을 대체합니다. 예시는 API Gateway가 Lambda 함수를 호출에서 확인하십시오.참고
한정자 정의는 리소스 유형별로 다릅니다. 지원되는 소스 및 대상 리소스 유형 목록은 AWS SAM 커넥터 참조 섹션을 참조하세요.
타입: 문자열
필수 항목 여부: 조건부
AWS CloudFormation 호환성: 이 속성은 AWS SAM 고유하며 AWS CloudFormation 이에 상응하는 속성이 없습니다.
-
QueueUrl
-
Amazon SQS 대기열의 URL. 이 속성은 Amazon SQS 리소스에만 적용됩니다.
타입: 문자열
필수 항목 여부: 조건부
AWS CloudFormation 호환성: 이 속성은 AWS SAM 고유하며 AWS CloudFormation 이에 상응하는 속성이 없습니다.
-
ResourceId
-
리소스의 ID. 에를 들면, API 게이트웨이 API ID.
타입: 문자열
필수 항목 여부: 조건부
AWS CloudFormation 호환성: 이 속성은 AWS SAM 고유하며 AWS CloudFormation 이에 상응하는 속성이 없습니다.
-
RoleName
-
리소스와 관련된 역할 이름.
참고
Id
이 지정된 경우, 커넥터가 IAM 정책을 생성하면 해당 정책에 연결된 IAM 역할이 리소스Id
에서 유추됩니다.Id
이 지정되지 않은 경우, 커넥터가 생성된 IAM 정책을 IAM 역할에 연결할 수 있도록 리소스의RoleName
를 제공하십시오.타입: 문자열
필수 항목 여부: 조건부
AWS CloudFormation 호환성: 이 속성은 AWS SAM 고유하며 AWS CloudFormation 이에 상응하는 속성이 없습니다.
-
Type
-
리소스 AWS CloudFormation 유형. 자세한 내용은 AWS 리소스 및 속성 유형 참조를 참조하세요.
타입: 문자열
필수 항목 여부: 조건부
AWS CloudFormation 호환성: 이 속성은 AWS SAM 고유하며 AWS CloudFormation 이에 상응하는 속성이 없습니다.
예
API Gateway가 Lambda 함수를 호출
다음 예제에서는 AWS::Serverless::Connector 리소스를 사용하여 Amazon API Gateway에서 AWS Lambda 함수를 호출할 수 있도록 허용합니다.
YAML
Transform: AWS::Serverless-2016-10-31 Resources: MyRole: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Statement: - Effect: Allow Action: sts:AssumeRole Principal: Service: lambda.amazonaws.com ManagedPolicyArns: - !Sub arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole MyFunction: Type: AWS::Lambda::Function Properties: Role: !GetAtt MyRole.Arn Runtime: nodejs16.x Handler: index.handler Code: ZipFile: | exports.handler = async (event) => { return { statusCode: 200, body: JSON.stringify({ "message": "It works!" }), }; }; MyApi: Type: AWS::ApiGatewayV2::Api Properties: Name: MyApi ProtocolType: HTTP MyStage: Type: AWS::ApiGatewayV2::Stage Properties: ApiId: !Ref MyApi StageName: prod AutoDeploy: True MyIntegration: Type: AWS::ApiGatewayV2::Integration Properties: ApiId: !Ref MyApi IntegrationType: AWS_PROXY IntegrationUri: !Sub arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${MyFunction.Arn}/invocations IntegrationMethod: POST PayloadFormatVersion: "2.0" MyRoute: Type: AWS::ApiGatewayV2::Route Properties: ApiId: !Ref MyApi RouteKey: GET /hello Target: !Sub integrations/${MyIntegration} MyConnector: Type: AWS::Serverless::Connector Properties: Source: # Use 'Id' when resource is in the same template Type: AWS::ApiGatewayV2::Api ResourceId: !Ref MyApi Qualifier: prod/GET/hello # Or "*" to allow all routes Destination: # Use 'Id' when resource is in the same template Type: AWS::Lambda::Function Arn: !GetAtt MyFunction.Arn Permissions: - Write Outputs: Endpoint: Value: !Sub https://${MyApi}.execute-api.${AWS::Region}.${AWS::URLSuffix}/prod/hello