AWS Elastic Beanstalk启动到默认VPC

时间:2018-06-07 07:28:19

标签: amazon-web-services elastic-beanstalk

我正在尝试将Tomcat Beanstalk实例启动到我的VPC中。但由于某种原因,实例不考虑我的配置模板。

我做了什么:

  1. 在单独的脚本中创建了一个VPC,并手动启动了所请求的实例并通过SSH连接到它
  2. 问题1:如果我出于某种原因使用云编队,脚本(下面)会为Beanstalk创建一个新的堆栈

    问题2:成功启动后,如果删除默认VPC,则会将beanstalk创建为默认VPC或崩溃。

    我该如何调试? 为什么会发生这种情况,因为我将正确的参数传递给脚本?

      SampleApplication:
        Type: 'AWS::ElasticBeanstalk::Application'
        Properties:
          ApplicationName: !Ref ApplicationName
          Description: OCAP's AWS Elastic Beanstalk Sample Application
    
      SampleApplicationVersion:
        Type: 'AWS::ElasticBeanstalk::ApplicationVersion'
        Properties:
          Description: Version 1.0
          ApplicationName: !Ref SampleApplication
          SourceBundle:
            S3Bucket: !Ref AppS3Bucket
            S3Key: !Ref AppS3Key
    
      SampleIdentityEnvironment:
        Type: 'AWS::ElasticBeanstalk::Environment'
        Properties:
          ApplicationName: !Ref SampleApplication
          EnvironmentName : OCAPSampleIdentityManager
          VersionLabel: !Ref SampleApplicationVersion
          SolutionStackName: !FindInMap [ StackMap, !Ref StackType, stackName ]
        DependsOn:
          - ConfigurationTemplate
          - SampleApplicationVersion
    

    ConfigurationTemplate:

    Type: AWS::ElasticBeanstalk::ConfigurationTemplate
    Properties:
      ApplicationName: !Ref SampleApplication
      Description: 64bit Amazon Linux running Tomcat 7
      SolutionStackName: !FindInMap [ StackMap, !Ref StackType, stackName ]
      OptionSettings:
    
        - Namespace: aws:autoscaling:launchconfiguration
          OptionName: EC2KeyName
          Value: !Ref KeyName
    
        - Namespace: aws:ec2:vpc
          OptionName: VPCId
          Value : vpc-0123456789
    
        - Namespace: 'aws:ec2:vpc'
          OptionName: Subnets
          Value: subnet-0123456789, subnet-0123456789
    
        - Namespace: 'aws:ec2:vpc'
          OptionName: ELBSubnets
          Value: subnet-0123456789, subnet-0123456789
    
        - Namespace: 'aws:ec2:vpc'
          OptionName: AssociatePublicIpAddress
          Value: 'true'
    

1 个答案:

答案 0 :(得分:0)

解决问题2: 您需要在“SampleIdentityEnvironment:”

中定义此项
TemplateName: !Ref ConfigurationTemplate