Я использую безсерверный фреймворк для развертывания безсерверного приложения в aws. Однако часть облачной информации не работает должным образом. Я посмотрел в Интернете и не смог найти ничего плохого в моем yaml.
Я создаю UserPool, а затем UserPoolClient с помощью Cloudformation. У меня есть следующий yaml для resources:
resources:
Resources:
HttpBucket:
Type: "AWS::S3::Bucket"
Properties:
BucketName: ${self:service}-${UserPoolId}
AccessControl: PublicRead
WebsiteConfiguration:
IndexDocument: index.html
UserPool:
Type: "AWS::Cognito::UserPool"
Properties:
UserPoolName: ${self:service}-user-pool
MfaConfiguration: "OFF"
EmailVerificationSubject: "Your verification code"
EmailVerificationMessage: "Your verification code is {####}. "
Schema:
- Name: name
AttributeDataType: String
Mutable: true
Required: true
- Name: email
AttributeDataType: String
Mutable: false
Required: true
- Name: teamName
AttributeDataType: String
Mutable: true
Required: false
- Name: custom:supportedTeam
AttributeDataType: String
Mutable: true
Required: false
- Name: custom:payment
AttributeDataType: String
Mutable: true
Required: false
DeveloperOnlyAttribute: true
UsernameAttributes:
- email
AutoVerifiedAttributes:
- email
AdminCreateUserConfig:
InviteMessageTemplate:
EmailMessage: 'Your username is {username} and temporary password is {####}. '
EmailSubject: Your temporary password
SMSMessage: 'Your username is {username} and temporary password is {####}. '
UnusedAccountValidityDays: 7
AllowAdminCreateUserOnly: false
Policies:
PasswordPolicy:
RequireLowercase: true
RequireSymbols: false
RequireNumbers: true
MinimumLength: 6
RequireUppercase: true
UserPoolClient:
Type: "AWS::Cognito::UserPoolClient"
Properties:
ClientName: ${self:service}-client
GenerateSecret: false
UserPoolId:
Ref: UserPool
Outputs:
UserPoolId:
Value:
Ref: UserPool
Export:
Name: "UserPool::Id"
UserPoolClientId:
Value:
Ref: UserPoolClient
Export:
Name: "UserPoolClient::Id"
Я не могу ссылаться на UserPool
при указании UserPoolClient
(для использования в качестве UserPoolId
.
Следующее:
UserPoolId:
Ref: UserPool
выдает ошибку:
Неверный синтаксис ссылки на переменную для переменной UserPoolId. Вы можете
только ссылки env vars, параметры и файлы. Вы можете проверить наши документы для
больше информации.
Еще одна вещь, в которой я не уверен, я видел людей, которые делятся yaml со следующим синтаксисом:
UserPoolId: !Ref UserPool
Но также происходит сбой и ошибки о неверном синтаксисе (из-за! Ref). Может кто-нибудь прояснить мне это?