Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services 找不到DBCluster的ReadEndpoint.Address_Amazon Web Services_Amazon Cloudformation_Amazon Rds_Amazon Route53 - Fatal编程技术网

Amazon web services 找不到DBCluster的ReadEndpoint.Address

Amazon web services 找不到DBCluster的ReadEndpoint.Address,amazon-web-services,amazon-cloudformation,amazon-rds,amazon-route53,Amazon Web Services,Amazon Cloudformation,Amazon Rds,Amazon Route53,我正在将路由53添加到我的DBCluster中,并不断遇到错误:属性:ReadEndpoint。找不到资源的地址: 整个堆栈是通过cloudformation创建的 另外,应该注意的是,这是针对无服务器极光的,以防有什么问题 这是我的密码: AWSTemplateFormatVersion: 2010-09-09 Description: RDS Aurora serverless template Parameters: CustomFunctionArn: Default: ar

我正在将路由53添加到我的DBCluster中,并不断遇到错误:
属性:ReadEndpoint。找不到资源的地址:

整个堆栈是通过cloudformation创建的

另外,应该注意的是,这是针对无服务器极光的,以防有什么问题

这是我的密码:

AWSTemplateFormatVersion: 2010-09-09
Description: RDS Aurora serverless template
Parameters:
  CustomFunctionArn:
    Default: arn:aws:lambda:us-west-2:123456789:function:vault-secrets-read-lambda-prod
    Description: The ARN of the lambda function to retrieve password from Vault
    Type: String
  DBName:
    AllowedPattern: '[a-zA-Z][a-zA-Z0-9]*'
    Description: Name of the database
    Type: String
  DBMasterUsername:
    AllowedPattern: '[a-zA-Z][a-zA-Z0-9]*'
    Description: The master user name for the DB instance
    Type: String
  DBScalingAutoPauseEnabled:
    AllowedValues:
      - 'true'
      - 'false'
    Default: 'true'
    Description: Pause all DB instances after some inactivity
    Type: String
  DBScalingMaxCapacity:
    AllowedValues:
      - 2
      - 4
      - 8
      - 16
      - 32
      - 64
      - 192
      - 384
    Default: 8
    Description: The maximum capacity for an Aurora DB cluster in serverless DB engine mode
    Type: Number
  DBScalingMinCapacity:
    AllowedValues:
      - 2
      - 4
      - 8
      - 16
      - 32
      - 64
      - 192
      - 384
    Default: 2
    Description: The minimum capacity for an Aurora DB cluster in serverless DB engine mode
    Type: Number
  DBScalingSecondsUntilAutoPause:
    Default: 300
    Description: Auto pause after consecutive seconds of inactivity
    MinValue: 300
    MaxValue: 86400
    Type: Number
  Env:
    AllowedValues:
      - prod
      - qa
      - dev
    Type: String
    Description: Environment
  VaultPath:
    Default: secret/dev/dbPassword
    Type: String
  SnapshotId:
    Description: snapshot ID to restore DB cluster from
    Type: String


Conditions:
  EnableAutoPause:
    !Equals [!Ref DBScalingAutoPauseEnabled, 'true']
  DoNotUseSnapshot: !Equals
    - !Ref SnapshotId
    - ''

Mappings:
  Configuration:
    prod:
      HostedZoneEnv: mydomain.com
      HostedZoneId: 'XXX'
      SecurityGroup: sg-123321
      SubnetGroups:
      - subnet-123
      - subnet-456
      - subnet-789
      VPCId: vpc-555
      Tags:
        - Key: Name
          Value: my-db
        - Key: environment
          Value: prod
        - Key: component
          Value: rds-aurora
        - Key: classification
          Value: internal
    qa:
      HostedZoneEnv: mydomain-qa.com
      HostedZoneId: 'XXX'
      SecurityGroup: sg-321123
      SubnetGroups:
      - subnet-098
      - subnet-765
      - subnet-432
      VPCId: vpc-345543
      Tags:
        - Key: Name
          Value: my-db
        - Key: environment
          Value: qa
        - Key: component
          Value: rds-aurora
        - Key: classification
          Value: internal
    dev:
      HostedZoneEnv: mydomain-dev.com
      HostedZoneId: 'XXX'
      SecurityGroup: sg-f3453f
      SubnetGroups:
      - subnet-dsf24327
      - subnet-82542gsda
      - subnet-casaf2344
      VPCId: vpc-23dfsf
      Tags:
        - Key: Name
          Value: my-db
        - Key: environment
          Value: dev
        - Key: component
          Value: rds-aurora
        - Key: classification
          Value: internal

Resources:
  AuroraSG:
    Type: AWS::EC2::SecurityGroup
    Properties:
      GroupDescription: Allows access to RDS
      GroupName: !Sub '${AWS::StackName}-aurora-rds-${Env}'
      SecurityGroupIngress:
      - IpProtocol: -1
        CidrIp: 0.0.0.0/0
        FromPort: 5432
        ToPort: 5432
      Tags: !FindInMap [Configuration, !Ref Env, Tags]
      VpcId: !FindInMap [Configuration, !Ref Env, VPCId]

  GetValuefromVault:
    Type: Custom::CustomResource
    Properties:
      ServiceToken: !Ref CustomFunctionArn
      VaultKeyPath: !Ref VaultPath

  DBCluster:
    Type: 'AWS::RDS::DBCluster'
    DeletionPolicy: Snapshot
    UpdateReplacePolicy: Snapshot
    Properties:
      BackupRetentionPeriod: 7
      DBClusterParameterGroupName: default.aurora-postgresql10
      DBSubnetGroupName: !Ref DBSubnetGroup
      DatabaseName: !Ref DBName
      DeletionProtection: false
      # EnableHttpEndpoint: true
      Engine: aurora-postgresql
      EngineMode: serverless
      EngineVersion: '10.7'
      KmsKeyId: !If [DoNotUseSnapshot, !Ref KMSkey, !Ref 'AWS::NoValue']
      MasterUserPassword: !If [DoNotUseSnapshot, !GetAtt 'GetValuefromVault.ValueFromVault', !Ref 'AWS::NoValue']
      MasterUsername: !If [DoNotUseSnapshot, !Ref DBMasterUsername, !Ref 'AWS::NoValue']
      Port: 5432
      ScalingConfiguration:
        AutoPause: !If [EnableAutoPause, true, false]
        MaxCapacity: !Ref DBScalingMaxCapacity
        MinCapacity: !Ref DBScalingMinCapacity
        SecondsUntilAutoPause: !Ref DBScalingSecondsUntilAutoPause
      SnapshotIdentifier: !If [DoNotUseSnapshot, !Ref 'AWS::NoValue', !Ref SnapshotId]
      StorageEncrypted: true
      Tags: !FindInMap [Configuration, !Ref Env, Tags]
      VpcSecurityGroupIds:
        - !GetAtt [AuroraSG, GroupId]
        - !FindInMap [Configuration, !Ref Env, SecurityGroup]

  DBSubnetGroup:
    Type: 'AWS::RDS::DBSubnetGroup'
    Properties:
      DBSubnetGroupDescription: !Sub '${AWS::StackName}-${Env}'
      SubnetIds: !FindInMap [Configuration, !Ref Env, SubnetGroups]
      Tags: !FindInMap [Configuration, !Ref Env, Tags]

  KmsAlias:
    Type: AWS::KMS::Alias
    Properties:
      AliasName: !Sub 'alias/${AWS::StackName}-${Env}-aurora-rds'
      TargetKeyId: !Ref KMSkey

  KMSkey:
    Type: AWS::KMS::Key
    Properties:
      KeyPolicy:
        Id: key-consolepolicy-3
        Version: 2012-10-17
        Statement:
          - Sid: Enable IAM User Permissions
            Effect: Allow
            Principal:
              AWS: !Sub arn:aws:iam::${AWS::AccountId}:root
            Action: 'kms:*'
            Resource: '*'

  RecordSet:
    Type: AWS::Route53::RecordSet
    DependsOn: DBCluster
    Properties:
      HostedZoneId: !FindInMap [Configuration, !Ref Env, HostedZoneId]
      Name: !Join ['', [!Ref DBName, -writer-db, ., !FindInMap [Configuration, !Ref Env, HostedZoneEnv], .]]
      ResourceRecords:
      - !GetAtt DBCluster.Endpoint.Address
      TTL: '60'
      Type: CNAME

  ReadRecordSet: 
    Type: 'AWS::Route53::RecordSet'
    DependsOn:
    - DBCluster
    Properties:
      HostedZoneId: !FindInMap [Configuration, !Ref Env, HostedZoneId]
      Name: !Join ['', [!Ref DBName, -reader-db, ., !FindInMap [Configuration, !Ref Env, HostedZoneEnv], .]] 
      ResourceRecords:
      - !GetAtt DBCluster.ReadEndpoint.Address
      TTL: '60'
      Type: CNAME

Outputs:
  AuroraHost:
    Value: !GetAtt [DBCluster, Endpoint.Address]
    Export:
      Name: !Join [":", [ !Ref "AWS::StackName", 'Host' ]]
  AuroraSG:
    Value: !GetAtt AuroraSG.GroupId
    Export:
      Name: !Join [":", [ !Ref "AWS::StackName", AuroraSG ]]
  KMS:
    Value: !GetAtt [KMSkey, Arn]
    Export:
      Name: !Join [":", [ !Ref "AWS::StackName", 'KMS' ]]
  DNSName:
    Description: 'The connection endpoint for the DB cluster.'
    Value: !GetAtt 'DBCluster.Endpoint.Address'
    Export:
      Name: !Sub '${AWS::StackName}-DNSName'
  ReadDNSName:
    Description: 'The reader endpoint for the DB cluster.'
    Value: !GetAtt 'DBCluster.ReadEndpoint.Address'
    Export:
      Name: !Sub '${AWS::StackName}-ReadDNSName'
我尝试过的一些事情:

  • 创建新堆栈:失败
  • 在没有ReadRecordSet的情况下创建新堆栈:失败
  • 创建没有记录集的新堆栈(读取记录集的旧名称):失败
  • 创建没有记录集的新堆栈(读取记录集的新名称):失败
  • DependsOn
    添加到ReadRecordSet(第一个记录集):失败
  • 在群集上启用HTTP终结点:失败
  • 将TTL更新为60:失败将TTL更新为0:失败
记录集
的创建似乎正常(我通过在ReadRecordSet中添加一个
DependsOn:-RecordSet
来测试它,以允许
记录集
首先创建),因此失败的是
ReadRecordSet
,无法找到ReadEndpoint.Address


我不确定我在这里遗漏了什么,一直在疯狂地搜索,没有看到关于这个错误的太多信息。感谢您的帮助

事实证明,Aurora Serverless不需要
ReadRecordSet
,因此整个部分仅适用于配置的数据库,因此
ReadEndpoint
实际上并不存在。不幸的是,AWS文档没有明确提到这一点。

对我来说,没有什么是错误的。您是否尝试过将DB实例添加到集群中?编辑:我刚刚注意到这是auroa servless。也许这就是serverless不存在的端点?是的,@jordanm我想你可能是对的,不幸的是,文档没有反映这一事实,事实上我读到的文档说它确实存在:但我认为在serverless的情况下,文档反映了它没有阅读器端点