首页 > 解决方案 > 将 RDS 添加到 Elastic Beanstalk 后,AWS Code Pipeline 失败

问题描述

我在 2020 年 1 月使用 CodeStar 模板创建了一个 EBS/Tomcat/Java 环境。最近,我按照这些说明在 EBS 控制台中添加了一个 RDS,以在 EBS中创建开发数据库。

由于添加了 RDS,我的 CodePipeline 在 CloudFormation 步骤中失败,并出现错误

环境更新活动失败。原因:配置验证异常:所需参数缺少值:AWSEBDBPassword

在最近事件下的我的 EBS 仪表板上。

它似乎缺少数据库密码或权限,但我不确定如何设置。

如果有帮助,这是我的 CodeStar 管道模板文件:

AWSTemplateFormatVersion: 2010-09-09
    Transform:
    - AWS::CodeStar
    Conditions:
      UseSubnet:
        Fn::Not:
        - Fn::Equals:
          - Ref: SubnetId
          - subnet-none
    Parameters:
      ProjectId:
        Type: String
        Description: AWS CodeStar project ID used to name project resources and create
          roles.
      InstanceType:
        Type: String
        Description: The type of Amazon EC2 Linux instances that will be launched for
          this project.
      KeyPairName:
        Type: String
        Description: The name of an existing Amazon EC2 key pair in the region where the
          project is created, which you can use to SSH into the new Amazon EC2 Linux instances.
      VpcId:
        Type: String
        Description: The ID of the Amazon Virtual Private Cloud (VPC) used for the new
          Amazon EC2 Linux instances.
      SubnetId:
        Type: String
        Description: The name of the VPC subnet used for the new Amazon EC2 Linux instances
          launched for this project.
      SolutionStackName:
        Type: String
        Description: The software stack used to launch environments and configure instances
          in AWS Elastic Beanstalk.
      EBTrustRole:
        Type: String
        Description: The service role in IAM for AWS Elastic Beanstalk to be created for
          this project.
      EBInstanceProfile:
        Type: String
        Description: The IAM role that will be created for the Amazon EC2 Linux instances.
      Stage:
        Type: String
        Description: The name for a project pipeline stage, such as Staging or Prod, for
          which resources are provisioned and deployed.
        Default: ''
    Resources:
      EBApplication:
        Description: The AWS Elastic Beanstalk application, which is a container used
          to deploy the correct application configuration.
        Type: AWS::ElasticBeanstalk::Application
        Properties:
          ApplicationName:
            Fn::Sub: ${ProjectId}app${Stage}
          Description: The name of the AWS Elastic Beanstalk application to be created
            for this project.
      EBApplicationVersion:
        Description: The version of the AWS Elastic Beanstalk application to be created
          for this project.
        Type: AWS::ElasticBeanstalk::ApplicationVersion
        Properties:
          ApplicationName:
            Ref: EBApplication
          Description: The application version number.
          SourceBundle:
            S3Bucket: aws-codestar-us-west-2-215674088663-aa5050solnprj3-pipe
            S3Key: 810d567534b4cb9ca0ee597128a22b94
      EBConfigurationTemplate:
        Description: The AWS Elastic Beanstalk configuration template to be created for
          this project, which defines configuration settings used to deploy different
          versions of an application.
        Type: AWS::ElasticBeanstalk::ConfigurationTemplate
        Properties:
          ApplicationName:
            Ref: EBApplication
          Description: The name of the sample configuration template.
          OptionSettings:
          - Namespace: aws:elasticbeanstalk:environment
            OptionName: EnvironmentType
            Value: SingleInstance
          - Namespace: aws:elasticbeanstalk:environment
            OptionName: ServiceRole
            Value:
              Ref: EBTrustRole
          - Namespace: aws:elasticbeanstalk:healthreporting:system
            OptionName: SystemType
            Value: enhanced
          SolutionStackName:
            Ref: SolutionStackName
      EBEnvironment:
        Description: The AWS Elastic Beanstalk deployment group where the application
          is deployed, which is made up of the Amazon EC2 Linux instances launched for
          this project.
        Type: AWS::ElasticBeanstalk::Environment
        Properties:
          ApplicationName:
            Ref: EBApplication
          EnvironmentName:
            Ref: EBApplication
          Description: The application to be deployed to the environment.
          TemplateName:
            Ref: EBConfigurationTemplate
          VersionLabel:
            Ref: EBApplicationVersion
          OptionSettings:
          - Namespace: aws:autoscaling:launchconfiguration
            OptionName: IamInstanceProfile
            Value:
              Ref: EBInstanceProfile
          - Namespace: aws:autoscaling:launchconfiguration
            OptionName: InstanceType
            Value:
              Ref: InstanceType
          - Namespace: aws:autoscaling:launchconfiguration
            OptionName: EC2KeyName
            Value:
              Ref: KeyPairName
          - Namespace: aws:ec2:vpc
            OptionName: VPCId
            Value:
              Ref: VpcId
          - Fn::If:
            - UseSubnet
            - Namespace: aws:ec2:vpc
              OptionName: Subnets
              Value:
                Ref: SubnetId
            - Ref: AWS::NoValue```

标签: amazon-web-servicesamazon-elastic-beanstalkamazon-rdsaws-codepipeline

解决方案


推荐阅读