这些引用来自此 AWS SAM 片段中的何处?
Where are these references coming from in this AWS SAM snippet?
在本文档中:
有这段 SAM 模板:
Resources:
MyApi:
Type: AWS::Serverless::Api
Properties:
StageName: Prod
Cors: "'*'"
Auth:
DefaultAuthorizer: MyCognitoAuthorizer
Authorizers:
MyCognitoAuthorizer:
UserPoolArn: !GetAtt MyCognitoUserPool.Arn
MyFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: ./src
Handler: lambda.handler
Runtime: nodejs12.x
Events:
Root:
Type: Api
Properties:
RestApiId: !Ref MyApi
Path: /
Method: GET
MyCognitoUserPool:
Type: AWS::Cognito::UserPool
Properties:
UserPoolName: !Ref CognitoUserPoolName
Policies:
PasswordPolicy:
MinimumLength: 8
UsernameAttributes:
- email
Schema:
- AttributeDataType: String
Name: email
Required: false
MyCognitoUserPoolClient:
Type: AWS::Cognito::UserPoolClient
Properties:
UserPoolId: !Ref MyCognitoUserPool
ClientName: !Ref CognitoUserPoolClientName
GenerateSecret: false
CognitoUserPoolName
和CognitoUserPoolClientName
定义在哪里?
此代码只是 CloudFormation 模板的一个片段。 CognitoUserPoolName
和 CognitoUserPoolClientName
是您应该指定的字符串。一种方法是将它们作为参数传递:
Parameters:
CognitoUserPoolName:
Type: String
Description: Cognito User Pool name
CognitoUserPoolClientName:
Type: String
Description: Cognito User Pool Client name
在本文档中:
有这段 SAM 模板:
Resources:
MyApi:
Type: AWS::Serverless::Api
Properties:
StageName: Prod
Cors: "'*'"
Auth:
DefaultAuthorizer: MyCognitoAuthorizer
Authorizers:
MyCognitoAuthorizer:
UserPoolArn: !GetAtt MyCognitoUserPool.Arn
MyFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: ./src
Handler: lambda.handler
Runtime: nodejs12.x
Events:
Root:
Type: Api
Properties:
RestApiId: !Ref MyApi
Path: /
Method: GET
MyCognitoUserPool:
Type: AWS::Cognito::UserPool
Properties:
UserPoolName: !Ref CognitoUserPoolName
Policies:
PasswordPolicy:
MinimumLength: 8
UsernameAttributes:
- email
Schema:
- AttributeDataType: String
Name: email
Required: false
MyCognitoUserPoolClient:
Type: AWS::Cognito::UserPoolClient
Properties:
UserPoolId: !Ref MyCognitoUserPool
ClientName: !Ref CognitoUserPoolClientName
GenerateSecret: false
CognitoUserPoolName
和CognitoUserPoolClientName
定义在哪里?
此代码只是 CloudFormation 模板的一个片段。 CognitoUserPoolName
和 CognitoUserPoolClientName
是您应该指定的字符串。一种方法是将它们作为参数传递:
Parameters:
CognitoUserPoolName:
Type: String
Description: Cognito User Pool name
CognitoUserPoolClientName:
Type: String
Description: Cognito User Pool Client name