AWS Шаблон CloudFormation для AWS :: ElasticBeanstalk :: ConfigurationTemplate не работает - PullRequest
1 голос
/ 11 июля 2020

Я пытаюсь развернуть образец приложения PHP в среде ElasticBeanstalk, используя шаблон CloudFormation в качестве попытки изучить CloudFormation, но это не удается.

Это мой шаблон.

AWSTemplateFormatVersion: '2010-09-09'
Description: AWS CloudFormation Sample PHP Application on ElasticBeanstalk Template
Parameters:
  KeyName:
    Description: Name of an existing EC2 KeyPair to enable SSH access to the AWS Elastic
      Beanstalk instance
    Type: AWS::EC2::KeyPair::KeyName
    ConstraintDescription: must be the name of an existing EC2 KeyPair.
Mappings:
  Region2Principal:
    us-east-1:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
    us-west-2:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
    us-west-1:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
    eu-west-1:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
    eu-west-2:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
    eu-west-3:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
    ap-southeast-1:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
    ap-northeast-1:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
    ap-northeast-2:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
    ap-northeast-3:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
    ap-southeast-2:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
    ap-south-1:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
    us-east-2:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
    ca-central-1:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
    sa-east-1:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
    cn-north-1:
      EC2Principal: ec2.amazonaws.com.cn
      OpsWorksPrincipal: opsworks.amazonaws.com.cn
    cn-northwest-1:
      EC2Principal: ec2.amazonaws.com.cn
      OpsWorksPrincipal: opsworks.amazonaws.com.cn
    eu-central-1:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
    eu-north-1:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
Resources:
  WebServerRole:
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Statement:
        - Effect: Allow
          Principal:
            Service:
            - Fn::FindInMap:
              - Region2Principal
              - Ref: AWS::Region
              - EC2Principal
          Action:
          - sts:AssumeRole
      Path: /
  WebServerRolePolicy:
    Type: AWS::IAM::Policy
    Properties:
      PolicyName: WebServerRole
      PolicyDocument:
        Statement:
        - Effect: Allow
          NotAction: iam:*
          Resource: '*'
      Roles:
      - Ref: WebServerRole
  WebServerInstanceProfile:
    Type: AWS::IAM::InstanceProfile
    Properties:
      Path: /
      Roles:
      - Ref: WebServerRole
  SampleApplication:
    Type: AWS::ElasticBeanstalk::Application
    Properties:
      Description: AWS Elastic Beanstalk Sample PHP Application
  SampleApplicationVersion:
    Type: AWS::ElasticBeanstalk::ApplicationVersion
    Properties:
      Description: Version 1.0
      ApplicationName:
        Ref: SampleApplication
      SourceBundle:
        S3Bucket:
          Fn::Join:
          - '-'
          - - elasticbeanstalk-samples
            - Ref: AWS::Region
        S3Key: php-sample.zip
  SampleConfigurationTemplate:
    Type: AWS::ElasticBeanstalk::ConfigurationTemplate
    Properties:
      ApplicationName:
        Ref: SampleApplication
      Description: SSH access to PHP Application
      SolutionStackName: 64bit Amazon Linux 2015.03 v2.0.0 running PHP 7.3
      OptionSettings:
      - Namespace: aws:autoscaling:launchconfiguration
        OptionName: EC2KeyName
        Value:
          Ref: KeyName
      - Namespace: aws:autoscaling:launchconfiguration
        OptionName: IamInstanceProfile
        Value:
          Ref: WebServerInstanceProfile
  SampleEnvironment:
    Type: AWS::ElasticBeanstalk::Environment
    Properties:
      Description: AWS Elastic Beanstalk Environment running Sample PHP Application
      ApplicationName:
        Ref: SampleApplication
      TemplateName:
        Ref: SampleConfigurationTemplate
      VersionLabel:
        Ref: SampleApplicationVersion
Outputs:
  URL:
    Description: URL of the AWS Elastic Beanstalk Environment
    Value:
      Fn::Join:
      - ''
      - - http://
        - Fn::GetAtt:
          - SampleEnvironment
          - EndpointURL

Когда я развернул, создание SampleConfigurationTemplate не удалось. Вот журнал событий.

{
    "StackEvents": [
        {
            "StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/LaravelAppFormation/0b82f990-c37e-11ea-8d87-0aae7861399e", 
            "EventId": "82616ce0-c37e-11ea-8481-064f9ddb6318", 
            "ResourceStatus": "ROLLBACK_COMPLETE", 
            "ResourceType": "AWS::CloudFormation::Stack", 
            "Timestamp": "2020-07-11T13:57:50.880Z", 
            "StackName": "LaravelAppFormation", 
            "PhysicalResourceId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/LaravelAppFormation/0b82f990-c37e-11ea-8d87-0aae7861399e", 
            "LogicalResourceId": "LaravelAppFormation"
        }, 
        {
            "StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/LaravelAppFormation/0b82f990-c37e-11ea-8d87-0aae7861399e", 
            "EventId": "SampleApplication-DELETE_COMPLETE-2020-07-11T13:57:50.278Z", 
            "ResourceStatus": "DELETE_COMPLETE", 
            "ResourceType": "AWS::ElasticBeanstalk::Application", 
            "Timestamp": "2020-07-11T13:57:50.278Z", 
            "StackName": "LaravelAppFormation", 
            "ResourceProperties": "{\"Description\":\"AWS Elastic Beanstalk Sample PHP Application\"}", 
            "PhysicalResourceId": "LaravelAppFormation-SampleApplication-1H2KNOYDRMM3Y", 
            "LogicalResourceId": "SampleApplication"
        }, 
        {
            "StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/LaravelAppFormation/0b82f990-c37e-11ea-8d87-0aae7861399e", 
            "EventId": "WebServerRole-DELETE_COMPLETE-2020-07-11T13:57:21.648Z", 
            "ResourceStatus": "DELETE_COMPLETE", 
            "ResourceType": "AWS::IAM::Role", 
            "Timestamp": "2020-07-11T13:57:21.648Z", 
            "StackName": "LaravelAppFormation", 
            "ResourceProperties": "{\"Path\":\"/\",\"AssumeRolePolicyDocument\":{\"Statement\":[{\"Action\":[\"sts:AssumeRole\"],\"Effect\":\"Allow\",\"Principal\":{\"Service\":[\"ec2.amazonaws.com\"]}}]}}", 
            "PhysicalResourceId": "LaravelAppFormation-WebServerRole-6V340ATLKJ5L", 
            "LogicalResourceId": "WebServerRole"
        }, 
        {
            "StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/LaravelAppFormation/0b82f990-c37e-11ea-8d87-0aae7861399e", 
            "EventId": "WebServerRole-DELETE_IN_PROGRESS-2020-07-11T13:57:20.421Z", 
            "ResourceStatus": "DELETE_IN_PROGRESS", 
            "ResourceType": "AWS::IAM::Role", 
            "Timestamp": "2020-07-11T13:57:20.421Z", 
            "StackName": "LaravelAppFormation", 
            "ResourceProperties": "{\"Path\":\"/\",\"AssumeRolePolicyDocument\":{\"Statement\":[{\"Action\":[\"sts:AssumeRole\"],\"Effect\":\"Allow\",\"Principal\":{\"Service\":[\"ec2.amazonaws.com\"]}}]}}", 
            "PhysicalResourceId": "LaravelAppFormation-WebServerRole-6V340ATLKJ5L", 
            "LogicalResourceId": "WebServerRole"
        }, 
        {
            "StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/LaravelAppFormation/0b82f990-c37e-11ea-8d87-0aae7861399e", 
            "EventId": "WebServerInstanceProfile-DELETE_COMPLETE-2020-07-11T13:57:19.780Z", 
            "ResourceStatus": "DELETE_COMPLETE", 
            "ResourceType": "AWS::IAM::InstanceProfile", 
            "Timestamp": "2020-07-11T13:57:19.780Z", 
            "StackName": "LaravelAppFormation", 
            "ResourceProperties": "{\"Path\":\"/\",\"Roles\":[\"LaravelAppFormation-WebServerRole-6V340ATLKJ5L\"]}", 
            "PhysicalResourceId": "LaravelAppFormation-WebServerInstanceProfile-DPQCH8RR6YD1", 
            "LogicalResourceId": "WebServerInstanceProfile"
        }, 
        {
            "StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/LaravelAppFormation/0b82f990-c37e-11ea-8d87-0aae7861399e", 
            "EventId": "SampleApplication-DELETE_IN_PROGRESS-2020-07-11T13:57:19.434Z", 
            "ResourceStatus": "DELETE_IN_PROGRESS", 
            "ResourceType": "AWS::ElasticBeanstalk::Application", 
            "Timestamp": "2020-07-11T13:57:19.434Z", 
            "StackName": "LaravelAppFormation", 
            "ResourceProperties": "{\"Description\":\"AWS Elastic Beanstalk Sample PHP Application\"}", 
            "PhysicalResourceId": "LaravelAppFormation-SampleApplication-1H2KNOYDRMM3Y", 
            "LogicalResourceId": "SampleApplication"
        }, 
        {
            "StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/LaravelAppFormation/0b82f990-c37e-11ea-8d87-0aae7861399e", 
            "EventId": "WebServerInstanceProfile-DELETE_IN_PROGRESS-2020-07-11T13:57:19.026Z", 
            "ResourceStatus": "DELETE_IN_PROGRESS", 
            "ResourceType": "AWS::IAM::InstanceProfile", 
            "Timestamp": "2020-07-11T13:57:19.026Z", 
            "StackName": "LaravelAppFormation", 
            "ResourceProperties": "{\"Path\":\"/\",\"Roles\":[\"LaravelAppFormation-WebServerRole-6V340ATLKJ5L\"]}", 
            "PhysicalResourceId": "LaravelAppFormation-WebServerInstanceProfile-DPQCH8RR6YD1", 
            "LogicalResourceId": "WebServerInstanceProfile"
        }, 
        {
            "StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/LaravelAppFormation/0b82f990-c37e-11ea-8d87-0aae7861399e", 
            "EventId": "WebServerRolePolicy-DELETE_COMPLETE-2020-07-11T13:57:19.019Z", 
            "ResourceStatus": "DELETE_COMPLETE", 
            "ResourceType": "AWS::IAM::Policy", 
            "Timestamp": "2020-07-11T13:57:19.019Z", 
            "StackName": "LaravelAppFormation", 
            "ResourceProperties": "{\"PolicyName\":\"WebServerRole\",\"PolicyDocument\":{\"Statement\":[{\"Resource\":\"*\",\"Effect\":\"Allow\",\"NotAction\":\"iam:*\"}]},\"Roles\":[\"LaravelAppFormation-WebServerRole-6V340ATLKJ5L\"]}", 
            "PhysicalResourceId": "Larav-WebS-1ENCAL1US6S3H", 
            "LogicalResourceId": "WebServerRolePolicy"
        }, 
        {
            "StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/LaravelAppFormation/0b82f990-c37e-11ea-8d87-0aae7861399e", 
            "EventId": "SampleApplicationVersion-DELETE_COMPLETE-2020-07-11T13:57:18.864Z", 
            "ResourceStatus": "DELETE_COMPLETE", 
            "ResourceType": "AWS::ElasticBeanstalk::ApplicationVersion", 
            "Timestamp": "2020-07-11T13:57:18.864Z", 
            "StackName": "LaravelAppFormation", 
            "ResourceProperties": "{\"Description\":\"Version 1.0\",\"ApplicationName\":\"LaravelAppFormation-SampleApplication-1H2KNOYDRMM3Y\",\"SourceBundle\":{\"S3Bucket\":\"elasticbeanstalk-samples-eu-west-1\",\"S3Key\":\"php-sample.zip\"}}", 
            "PhysicalResourceId": "laravelappformation-sampleapplicationversion-18698t4vsesv3", 
            "LogicalResourceId": "SampleApplicationVersion"
        }, 
        {
            "StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/LaravelAppFormation/0b82f990-c37e-11ea-8d87-0aae7861399e", 
            "EventId": "WebServerRolePolicy-DELETE_IN_PROGRESS-2020-07-11T13:57:18.497Z", 
            "ResourceStatus": "DELETE_IN_PROGRESS", 
            "ResourceType": "AWS::IAM::Policy", 
            "Timestamp": "2020-07-11T13:57:18.497Z", 
            "StackName": "LaravelAppFormation", 
            "ResourceProperties": "{\"PolicyName\":\"WebServerRole\",\"PolicyDocument\":{\"Statement\":[{\"Resource\":\"*\",\"Effect\":\"Allow\",\"NotAction\":\"iam:*\"}]},\"Roles\":[\"LaravelAppFormation-WebServerRole-6V340ATLKJ5L\"]}", 
            "PhysicalResourceId": "Larav-WebS-1ENCAL1US6S3H", 
            "LogicalResourceId": "WebServerRolePolicy"
        }, 
        {
            "StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/LaravelAppFormation/0b82f990-c37e-11ea-8d87-0aae7861399e", 
            "EventId": "SampleConfigurationTemplate-DELETE_COMPLETE-2020-07-11T13:57:18.452Z", 
            "ResourceStatus": "DELETE_COMPLETE", 
            "ResourceType": "AWS::ElasticBeanstalk::ConfigurationTemplate", 
            "Timestamp": "2020-07-11T13:57:18.452Z", 
            "StackName": "LaravelAppFormation", 
            "ResourceProperties": "{\"ApplicationName\":\"LaravelAppFormation-SampleApplication-1H2KNOYDRMM3Y\",\"Description\":\"SSH access to PHP Application\",\"OptionSettings\":[{\"Value\":\"MyanEat\",\"Namespace\":\"aws:autoscaling:launchconfiguration\",\"OptionName\":\"EC2KeyName\"},{\"Value\":\"LaravelAppFormation-WebServerInstanceProfile-DPQCH8RR6YD1\",\"Namespace\":\"aws:autoscaling:launchconfiguration\",\"OptionName\":\"IamInstanceProfile\"}],\"SolutionStackName\":\"64bit Amazon Linux 2015.03 v2.0.0 running PHP 7.3\"}", 
            "PhysicalResourceId": "", 
            "LogicalResourceId": "SampleConfigurationTemplate"
        }, 
        {
            "StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/LaravelAppFormation/0b82f990-c37e-11ea-8d87-0aae7861399e", 
            "EventId": "SampleApplicationVersion-DELETE_IN_PROGRESS-2020-07-11T13:57:18.446Z", 
            "ResourceStatus": "DELETE_IN_PROGRESS", 
            "ResourceType": "AWS::ElasticBeanstalk::ApplicationVersion", 
            "Timestamp": "2020-07-11T13:57:18.446Z", 
            "StackName": "LaravelAppFormation", 
            "ResourceProperties": "{\"Description\":\"Version 1.0\",\"ApplicationName\":\"LaravelAppFormation-SampleApplication-1H2KNOYDRMM3Y\",\"SourceBundle\":{\"S3Bucket\":\"elasticbeanstalk-samples-eu-west-1\",\"S3Key\":\"php-sample.zip\"}}", 
            "PhysicalResourceId": "laravelappformation-sampleapplicationversion-18698t4vsesv3", 
            "LogicalResourceId": "SampleApplicationVersion"
        }, 
        {
            "StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/LaravelAppFormation/0b82f990-c37e-11ea-8d87-0aae7861399e", 
            "EventId": "6468b220-c37e-11ea-90bc-0af2c101a642", 
            "ResourceStatus": "ROLLBACK_IN_PROGRESS", 
            "ResourceType": "AWS::CloudFormation::Stack", 
            "Timestamp": "2020-07-11T13:57:00.597Z", 
            "ResourceStatusReason": "The following resource(s) failed to create: [SampleConfigurationTemplate]. . Rollback requested by user.", 
            "StackName": "LaravelAppFormation", 
            "PhysicalResourceId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/LaravelAppFormation/0b82f990-c37e-11ea-8d87-0aae7861399e", 
            "LogicalResourceId": "LaravelAppFormation"
        }, 
        {
            "StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/LaravelAppFormation/0b82f990-c37e-11ea-8d87-0aae7861399e", 
            "EventId": "SampleConfigurationTemplate-CREATE_FAILED-2020-07-11T13:56:59.855Z", 
            "ResourceStatus": "CREATE_FAILED", 
            "ResourceType": "AWS::ElasticBeanstalk::ConfigurationTemplate", 
            "Timestamp": "2020-07-11T13:56:59.855Z", 
            "ResourceStatusReason": "No Solution Stack named '64bit Amazon Linux 2015.03 v2.0.0 running PHP 7.3' found. (Service: AWSElasticBeanstalk; Status Code: 400; Error Code: InvalidParameterValue; Request ID: 711043f9-e724-48aa-8949-84f8b72f40bc)", 
            "StackName": "LaravelAppFormation", 
            "ResourceProperties": "{\"ApplicationName\":\"LaravelAppFormation-SampleApplication-1H2KNOYDRMM3Y\",\"Description\":\"SSH access to PHP Application\",\"OptionSettings\":[{\"Value\":\"MyanEat\",\"Namespace\":\"aws:autoscaling:launchconfiguration\",\"OptionName\":\"EC2KeyName\"},{\"Value\":\"LaravelAppFormation-WebServerInstanceProfile-DPQCH8RR6YD1\",\"Namespace\":\"aws:autoscaling:launchconfiguration\",\"OptionName\":\"IamInstanceProfile\"}],\"SolutionStackName\":\"64bit Amazon Linux 2015.03 v2.0.0 running PHP 7.3\"}", 
            "PhysicalResourceId": "", 
            "LogicalResourceId": "SampleConfigurationTemplate"
        }, 
        {
            "StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/LaravelAppFormation/0b82f990-c37e-11ea-8d87-0aae7861399e", 
            "EventId": "SampleConfigurationTemplate-CREATE_IN_PROGRESS-2020-07-11T13:56:59.582Z", 
            "ResourceStatus": "CREATE_IN_PROGRESS", 
            "ResourceType": "AWS::ElasticBeanstalk::ConfigurationTemplate", 
            "Timestamp": "2020-07-11T13:56:59.582Z", 
            "StackName": "LaravelAppFormation", 
            "ResourceProperties": "{\"ApplicationName\":\"LaravelAppFormation-SampleApplication-1H2KNOYDRMM3Y\",\"Description\":\"SSH access to PHP Application\",\"OptionSettings\":[{\"Value\":\"MyanEat\",\"Namespace\":\"aws:autoscaling:launchconfiguration\",\"OptionName\":\"EC2KeyName\"},{\"Value\":\"LaravelAppFormation-WebServerInstanceProfile-DPQCH8RR6YD1\",\"Namespace\":\"aws:autoscaling:launchconfiguration\",\"OptionName\":\"IamInstanceProfile\"}],\"SolutionStackName\":\"64bit Amazon Linux 2015.03 v2.0.0 running PHP 7.3\"}", 
            "PhysicalResourceId": "", 
            "LogicalResourceId": "SampleConfigurationTemplate"
        }, 
        {
            "StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/LaravelAppFormation/0b82f990-c37e-11ea-8d87-0aae7861399e", 
            "EventId": "WebServerInstanceProfile-CREATE_COMPLETE-2020-07-11T13:56:57.951Z", 
            "ResourceStatus": "CREATE_COMPLETE", 
            "ResourceType": "AWS::IAM::InstanceProfile", 
            "Timestamp": "2020-07-11T13:56:57.951Z", 
            "StackName": "LaravelAppFormation", 
            "ResourceProperties": "{\"Path\":\"/\",\"Roles\":[\"LaravelAppFormation-WebServerRole-6V340ATLKJ5L\"]}", 
            "PhysicalResourceId": "LaravelAppFormation-WebServerInstanceProfile-DPQCH8RR6YD1", 
            "LogicalResourceId": "WebServerInstanceProfile"
        }, 
        {
            "StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/LaravelAppFormation/0b82f990-c37e-11ea-8d87-0aae7861399e", 
            "EventId": "WebServerRolePolicy-CREATE_COMPLETE-2020-07-11T13:55:11.041Z", 
            "ResourceStatus": "CREATE_COMPLETE", 
            "ResourceType": "AWS::IAM::Policy", 
            "Timestamp": "2020-07-11T13:55:11.041Z", 
            "StackName": "LaravelAppFormation", 
            "ResourceProperties": "{\"PolicyName\":\"WebServerRole\",\"PolicyDocument\":{\"Statement\":[{\"Resource\":\"*\",\"Effect\":\"Allow\",\"NotAction\":\"iam:*\"}]},\"Roles\":[\"LaravelAppFormation-WebServerRole-6V340ATLKJ5L\"]}", 
            "PhysicalResourceId": "Larav-WebS-1ENCAL1US6S3H", 
            "LogicalResourceId": "WebServerRolePolicy"
        }, 
        {
            "StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/LaravelAppFormation/0b82f990-c37e-11ea-8d87-0aae7861399e", 
            "EventId": "WebServerRolePolicy-CREATE_IN_PROGRESS-2020-07-11T13:54:57.881Z", 
            "ResourceStatus": "CREATE_IN_PROGRESS", 
            "ResourceType": "AWS::IAM::Policy", 
            "Timestamp": "2020-07-11T13:54:57.881Z", 
            "ResourceStatusReason": "Resource creation Initiated", 
            "StackName": "LaravelAppFormation", 
            "ResourceProperties": "{\"PolicyName\":\"WebServerRole\",\"PolicyDocument\":{\"Statement\":[{\"Resource\":\"*\",\"Effect\":\"Allow\",\"NotAction\":\"iam:*\"}]},\"Roles\":[\"LaravelAppFormation-WebServerRole-6V340ATLKJ5L\"]}", 
            "PhysicalResourceId": "Larav-WebS-1ENCAL1US6S3H", 
            "LogicalResourceId": "WebServerRolePolicy"
        }, 
        {
            "StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/LaravelAppFormation/0b82f990-c37e-11ea-8d87-0aae7861399e", 
            "EventId": "WebServerInstanceProfile-CREATE_IN_PROGRESS-2020-07-11T13:54:57.343Z", 
            "ResourceStatus": "CREATE_IN_PROGRESS", 
            "ResourceType": "AWS::IAM::InstanceProfile", 
            "Timestamp": "2020-07-11T13:54:57.343Z", 
            "ResourceStatusReason": "Resource creation Initiated", 
            "StackName": "LaravelAppFormation", 
            "ResourceProperties": "{\"Path\":\"/\",\"Roles\":[\"LaravelAppFormation-WebServerRole-6V340ATLKJ5L\"]}", 
            "PhysicalResourceId": "LaravelAppFormation-WebServerInstanceProfile-DPQCH8RR6YD1", 
            "LogicalResourceId": "WebServerInstanceProfile"
        }, 
        {
            "StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/LaravelAppFormation/0b82f990-c37e-11ea-8d87-0aae7861399e", 
            "EventId": "WebServerInstanceProfile-CREATE_IN_PROGRESS-2020-07-11T13:54:57.020Z", 
            "ResourceStatus": "CREATE_IN_PROGRESS", 
            "ResourceType": "AWS::IAM::InstanceProfile", 
            "Timestamp": "2020-07-11T13:54:57.020Z", 
            "StackName": "LaravelAppFormation", 
            "ResourceProperties": "{\"Path\":\"/\",\"Roles\":[\"LaravelAppFormation-WebServerRole-6V340ATLKJ5L\"]}", 
            "PhysicalResourceId": "", 
            "LogicalResourceId": "WebServerInstanceProfile"
        }, 
        {
            "StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/LaravelAppFormation/0b82f990-c37e-11ea-8d87-0aae7861399e", 
            "EventId": "WebServerRolePolicy-CREATE_IN_PROGRESS-2020-07-11T13:54:56.997Z", 
            "ResourceStatus": "CREATE_IN_PROGRESS", 
            "ResourceType": "AWS::IAM::Policy", 
            "Timestamp": "2020-07-11T13:54:56.997Z", 
            "StackName": "LaravelAppFormation", 
            "ResourceProperties": "{\"PolicyName\":\"WebServerRole\",\"PolicyDocument\":{\"Statement\":[{\"Resource\":\"*\",\"Effect\":\"Allow\",\"NotAction\":\"iam:*\"}]},\"Roles\":[\"LaravelAppFormation-WebServerRole-6V340ATLKJ5L\"]}", 
            "PhysicalResourceId": "", 
            "LogicalResourceId": "WebServerRolePolicy"
        }, 
        {
            "StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/LaravelAppFormation/0b82f990-c37e-11ea-8d87-0aae7861399e", 
            "EventId": "WebServerRole-CREATE_COMPLETE-2020-07-11T13:54:55.161Z", 
            "ResourceStatus": "CREATE_COMPLETE", 
            "ResourceType": "AWS::IAM::Role", 
            "Timestamp": "2020-07-11T13:54:55.161Z", 
            "StackName": "LaravelAppFormation", 
            "ResourceProperties": "{\"Path\":\"/\",\"AssumeRolePolicyDocument\":{\"Statement\":[{\"Action\":[\"sts:AssumeRole\"],\"Effect\":\"Allow\",\"Principal\":{\"Service\":[\"ec2.amazonaws.com\"]}}]}}", 
            "PhysicalResourceId": "LaravelAppFormation-WebServerRole-6V340ATLKJ5L", 
            "LogicalResourceId": "WebServerRole"
        }, 
        {
            "StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/LaravelAppFormation/0b82f990-c37e-11ea-8d87-0aae7861399e", 
            "EventId": "SampleApplicationVersion-CREATE_COMPLETE-2020-07-11T13:54:44.199Z", 
            "ResourceStatus": "CREATE_COMPLETE", 
            "ResourceType": "AWS::ElasticBeanstalk::ApplicationVersion", 
            "Timestamp": "2020-07-11T13:54:44.199Z", 
            "StackName": "LaravelAppFormation", 
            "ResourceProperties": "{\"Description\":\"Version 1.0\",\"ApplicationName\":\"LaravelAppFormation-SampleApplication-1H2KNOYDRMM3Y\",\"SourceBundle\":{\"S3Bucket\":\"elasticbeanstalk-samples-eu-west-1\",\"S3Key\":\"php-sample.zip\"}}", 
            "PhysicalResourceId": "laravelappformation-sampleapplicationversion-18698t4vsesv3", 
            "LogicalResourceId": "SampleApplicationVersion"
        }, 
        {
            "StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/LaravelAppFormation/0b82f990-c37e-11ea-8d87-0aae7861399e", 
            "EventId": "SampleApplicationVersion-CREATE_IN_PROGRESS-2020-07-11T13:54:44.066Z", 
            "ResourceStatus": "CREATE_IN_PROGRESS", 
            "ResourceType": "AWS::ElasticBeanstalk::ApplicationVersion", 
            "Timestamp": "2020-07-11T13:54:44.066Z", 
            "ResourceStatusReason": "Resource creation Initiated", 
            "StackName": "LaravelAppFormation", 
            "ResourceProperties": "{\"Description\":\"Version 1.0\",\"ApplicationName\":\"LaravelAppFormation-SampleApplication-1H2KNOYDRMM3Y\",\"SourceBundle\":{\"S3Bucket\":\"elasticbeanstalk-samples-eu-west-1\",\"S3Key\":\"php-sample.zip\"}}", 
            "PhysicalResourceId": "laravelappformation-sampleapplicationversion-18698t4vsesv3", 
            "LogicalResourceId": "SampleApplicationVersion"
        }, 
        {
            "StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/LaravelAppFormation/0b82f990-c37e-11ea-8d87-0aae7861399e", 
            "EventId": "SampleApplicationVersion-CREATE_IN_PROGRESS-2020-07-11T13:54:43.436Z", 
            "ResourceStatus": "CREATE_IN_PROGRESS", 
            "ResourceType": "AWS::ElasticBeanstalk::ApplicationVersion", 
            "Timestamp": "2020-07-11T13:54:43.436Z", 
            "StackName": "LaravelAppFormation", 
            "ResourceProperties": "{\"Description\":\"Version 1.0\",\"ApplicationName\":\"LaravelAppFormation-SampleApplication-1H2KNOYDRMM3Y\",\"SourceBundle\":{\"S3Bucket\":\"elasticbeanstalk-samples-eu-west-1\",\"S3Key\":\"php-sample.zip\"}}", 
            "PhysicalResourceId": "", 
            "LogicalResourceId": "SampleApplicationVersion"
        }, 
        {
            "StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/LaravelAppFormation/0b82f990-c37e-11ea-8d87-0aae7861399e", 
            "EventId": "SampleApplication-CREATE_COMPLETE-2020-07-11T13:54:41.715Z", 
            "ResourceStatus": "CREATE_COMPLETE", 
            "ResourceType": "AWS::ElasticBeanstalk::Application", 
            "Timestamp": "2020-07-11T13:54:41.715Z", 
            "StackName": "LaravelAppFormation", 
            "ResourceProperties": "{\"Description\":\"AWS Elastic Beanstalk Sample PHP Application\"}", 
            "PhysicalResourceId": "LaravelAppFormation-SampleApplication-1H2KNOYDRMM3Y", 
            "LogicalResourceId": "SampleApplication"
        }, 
        //...............
    ]
}

Что не так с моим шаблоном и как я могу это исправить?

1 Ответ

1 голос
/ 11 июля 2020

Ошибка сводится к следующему: No Solution Stack named '64bit Amazon Linux 2015.03 v2.0.0 running PHP 7.3' found.

Это не поддерживаемая версия PHP. Вместо этого вы должны использовать 64bit Amazon Linux 2 v3.0.3 running PHP 7.3, который ближе всего к вашей проблеме.

Я обновил шаблон ниже

AWSTemplateFormatVersion: '2010-09-09'
Description: AWS CloudFormation Sample PHP Application on ElasticBeanstalk Template
Parameters:
  KeyName:
    Description: Name of an existing EC2 KeyPair to enable SSH access to the AWS Elastic
      Beanstalk instance
    Type: AWS::EC2::KeyPair::KeyName
    ConstraintDescription: must be the name of an existing EC2 KeyPair.
Mappings:
  Region2Principal:
    us-east-1:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
    us-west-2:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
    us-west-1:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
    eu-west-1:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
    eu-west-2:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
    eu-west-3:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
    ap-southeast-1:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
    ap-northeast-1:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
    ap-northeast-2:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
    ap-northeast-3:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
    ap-southeast-2:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
    ap-south-1:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
    us-east-2:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
    ca-central-1:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
    sa-east-1:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
    cn-north-1:
      EC2Principal: ec2.amazonaws.com.cn
      OpsWorksPrincipal: opsworks.amazonaws.com.cn
    cn-northwest-1:
      EC2Principal: ec2.amazonaws.com.cn
      OpsWorksPrincipal: opsworks.amazonaws.com.cn
    eu-central-1:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
    eu-north-1:
      EC2Principal: ec2.amazonaws.com
      OpsWorksPrincipal: opsworks.amazonaws.com
Resources:
  WebServerRole:
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Statement:
        - Effect: Allow
          Principal:
            Service:
            - Fn::FindInMap:
              - Region2Principal
              - Ref: AWS::Region
              - EC2Principal
          Action:
          - sts:AssumeRole
      Path: /
  WebServerRolePolicy:
    Type: AWS::IAM::Policy
    Properties:
      PolicyName: WebServerRole
      PolicyDocument:
        Statement:
        - Effect: Allow
          NotAction: iam:*
          Resource: '*'
      Roles:
      - Ref: WebServerRole
  WebServerInstanceProfile:
    Type: AWS::IAM::InstanceProfile
    Properties:
      Path: /
      Roles:
      - Ref: WebServerRole
  SampleApplication:
    Type: AWS::ElasticBeanstalk::Application
    Properties:
      Description: AWS Elastic Beanstalk Sample PHP Application
  SampleApplicationVersion:
    Type: AWS::ElasticBeanstalk::ApplicationVersion
    Properties:
      Description: Version 1.0
      ApplicationName:
        Ref: SampleApplication
      SourceBundle:
        S3Bucket:
          Fn::Join:
          - '-'
          - - elasticbeanstalk-samples
            - Ref: AWS::Region
        S3Key: php-sample.zip
  SampleConfigurationTemplate:
    Type: AWS::ElasticBeanstalk::ConfigurationTemplate
    Properties:
      ApplicationName:
        Ref: SampleApplication
      Description: SSH access to PHP Application
      SolutionStackName: 64bit Amazon Linux 2 v3.0.3 running PHP 7.3
      OptionSettings:
      - Namespace: aws:autoscaling:launchconfiguration
        OptionName: EC2KeyName
        Value:
          Ref: KeyName
      - Namespace: aws:autoscaling:launchconfiguration
        OptionName: IamInstanceProfile
        Value:
          Ref: WebServerInstanceProfile
  SampleEnvironment:
    Type: AWS::ElasticBeanstalk::Environment
    Properties:
      Description: AWS Elastic Beanstalk Environment running Sample PHP Application
      ApplicationName:
        Ref: SampleApplication
      TemplateName:
        Ref: SampleConfigurationTemplate
      VersionLabel:
        Ref: SampleApplicationVersion
Outputs:
  URL:
    Description: URL of the AWS Elastic Beanstalk Environment
    Value:
      Fn::Join:
      - ''
      - - http://
        - Fn::GetAtt:
          - SampleEnvironment
          - EndpointURL
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...