簡體   English   中英

使用 AWS Cloud Formation 模板創建具有 Java 示例應用程序的新應用程序的 Elastic Beanstalk 環境

[英]Creating Elastic Beanstalk environment with new application with Java Sample Application using AWS Cloud Formation template

我有點堅持這個。 我設法使用自己的 Cloud Formation 模板創建了一個彈性 beanstalk 環境,但我只能為現有應用程序啟動它。 如何使用相同的資源 (AWS::ElasticBeanstalk::Environment) 創建新應用程序,以及如何使用相同的模板將標准 AWS Java 示例應用程序部署到這個新環境。

如果我使用這個:

Resources:
  MyEB:
    Type: AWS::ElasticBeanstalk::Environment
    Properties:
      ApplicationName: customerApp

會有一個錯誤提示customerApp不存在。

根據 Marcin 的要求,我刪除了值以使其更短的完整模板(如果有意義的話):

Resources:
  MyEB:
    Type: AWS::ElasticBeanstalk::Environment
    Properties:
      ApplicationName: customerApp
      Description: Test
      PlatformArn: arn:aws:elasticbeanstalk:eu-west-1::platform/Tomcat 8.5 with Corretto 8 running on 64bit Amazon Linux 2/4.2.17
      EnvironmentName: iw-test3
      OptionSettings:
        - Namespace: aws:autoscaling:launchconfiguration
          OptionName: ImageId

        - Namespace: aws:autoscaling:launchconfiguration
          OptionName: DisableIMDSv1

        - Namespace: aws:elasticbeanstalk:application:environment
          OptionName: username

        - Namespace: aws:elasticbeanstalk:application:environment
          OptionName: password

        - Namespace: aws:elasticbeanstalk:application:environment
          OptionName: rest_client_id

        - Namespace: aws:elasticbeanstalk:application:environment
          OptionName: rest_client_secret

        - Namespace: aws:ec2:vpc
          OptionName: VPCId      

        - Namespace: aws:ec2:vpc
          OptionName: Subnets

        - Namespace: aws:ec2:vpc
          OptionName: ELBSubnets

        - Namespace: aws:elbv2:loadbalancer
          OptionName: SharedLoadBalancer 
        
        - Namespace: aws:elbv2:listener:443
          OptionName: Rules   

        - Namespace: aws:elasticbeanstalk:environment:process:default
          OptionName: HealthCheckPath
          Value: /health

        - Namespace: aws:elasticbeanstalk:managedactions
          OptionName: ManagedActionsEnabled
          Value: true

        - Namespace: aws:elasticbeanstalk:managedactions
          OptionName: PreferredStartTime

        - Namespace: aws:elasticbeanstalk:managedactions:platformupdate
          OptionName: UpdateLevel

        - Namespace: aws:ec2:instances
          OptionName: InstanceTypes
    
        - Namespace: aws:ec2:instances
          OptionName: SupportedArchitectures

        - Namespace: aws:autoscaling:asg
          OptionName: MaxSize

        - Namespace: aws:elasticbeanstalk:environment:proxy
          OptionName: ProxyServer

        - Namespace: aws:elasticbeanstalk:environment
          OptionName: ServiceRole

        - Namespace: aws:elasticbeanstalk:environment
          OptionName: LoadBalancerIsShared

        - Namespace: aws:elasticbeanstalk:environment
          OptionName: LoadBalancerType

        - Namespace: aws:ec2:vpc
          OptionName: AssociatePublicIpAddress

        - Namespace: aws:autoscaling:launchconfiguration
          OptionName: IamInstanceProfile     

        - Namespace: aws:elbv2:listenerrule:dnsRule
          OptionName: PathPatterns
       
        - Namespace: aws:elbv2:listenerrule:dnsRule
          OptionName: Priority        

        - Namespace: aws:elbv2:listenerrule:dnsRule
          OptionName: Process
      
        - Namespace: aws:elbv2:listenerrule:dnsRule
          OptionName: HostHeaders
         

更新

我添加了以下資源:

MyApplication:
    Type: AWS::ElasticBeanstalk::Application
    Properties:
      Description: Test Application 
  MyApplicationVarsion:
    Type: AWS::ElasticBeanstalk::ApplicationVersion
    Properties:
      ApplicationName: customerApp_IW
      Description: Test Application Version
      SourceBundle: 
        S3Bucket: !Sub "elasticbeanstalk-samples-${AWS::Region}"
        S3Key: corretto.zip

現在得到的錯誤是:

Unable to download from S3 location (Bucket: elasticbeanstalk-samples-eu-west-1 Key: corretto.zip). Reason: Forbidden: S3Bucket=elasticbeanstalk-samples-eu-west-1, S3Key=corretto.zip (Service: AWSElasticBeanstalk; Status Code: 400; Error Code: InvalidParameterCombination; Request ID: 8abc30ac-fd88-4828-95bd-67e3ed69aebe; Proxy: null)

您必須定義自己的AWS::ElasticBeanstalk::ApplicationVersion 然后定義VersionLabel以部署您的特定 zip。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM