AWS::ElasticBeanstalk::ConfigurationTemplate 的 AWS CloudFormation 模板失败
Posted
技术标签:
【中文标题】AWS::ElasticBeanstalk::ConfigurationTemplate 的 AWS CloudFormation 模板失败【英文标题】:AWS CloudFormation template for AWS::ElasticBeanstalk::ConfigurationTemplate is failing 【发布时间】:2020-11-01 03:09:18 【问题描述】:我正在尝试使用 CloudFormation 模板将示例 php 应用程序部署到 ElasticBeanstalk 环境以尝试学习 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】:错误归结为以下No Solution Stack named '64bit Amazon Linux 2015.03 v2.0.0 running PHP 7.3' found.
这不是supported version of 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
【讨论】:
我已经运行了这个更新的模板,它成功地为我运行了,试一试:)以上是关于AWS::ElasticBeanstalk::ConfigurationTemplate 的 AWS CloudFormation 模板失败的主要内容,如果未能解决你的问题,请参考以下文章