#amazon-web-services #aws-sam
#amazon-web-services #aws-sam
Вопрос:
В этой документации:
вот этот фрагмент шаблона 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
определены?
Ответ №1:
Этот код представляет собой всего лишь фрагмент из шаблона CloudFormation. CognitoUserPoolName
и CognitoUserPoolClientName
являются строками, которые должны быть указаны вами. Один из способов сделать это — передать их в качестве параметров:
Parameters:
CognitoUserPoolName:
Type: String
Description: Cognito User Pool name
CognitoUserPoolClientName:
Type: String
Description: Cognito User Pool Client name