首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >利用AWS云形成模板用Java样例创建弹性豆茎环境

利用AWS云形成模板用Java样例创建弹性豆茎环境
EN

Stack Overflow用户
提问于 2022-08-17 11:26:01
回答 1查看 197关注 0票数 1

我有点被这个困住了。我用自己的云形成模板创建了一个弹性豆茎环境,但我只能为现有的应用程序启动它。如何使用相同的资源( AWS::ElasticBean秸秆::environment )来创建新的应用程序,以及如何使用相同的模板将标准的AWS Java示例应用程序部署到这个新环境。

如果我用这个:

代码语言:javascript
复制
Resources:
  MyEB:
    Type: AWS::ElasticBeanstalk::Environment
    Properties:
      ApplicationName: customerApp

如果说customerApp不存在,就会出现错误。

根据Marcin的请求,我的完整模板中删除了值,以便使其更短,如果这是有意义的话:

代码语言:javascript
复制
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

更新

我增加了以下资源:

代码语言:javascript
复制
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

现在出现的错误是:

代码语言:javascript
复制
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)
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-08-17 11:45:52

您必须定义自己的AWS::ElasticBean秸秆::ApplicationVersion。然后定义VersionLabel来部署特定的zip。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73387648

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档