我正在为我的应用程序设置服务器基础结构。我为此使用AWS CloudFormation。我是CloudFormation的新手。
我有带有以下代码的template.yml
---
AWSTemplateFormatVersion: '2010-09-09'
Description: 'AWS CloudFormation Sample Template ElasticBeanstalk_Nodejs_Sample: Configure
and launch the AWS Elastic Beanstalk sample application. **WARNING** This template
creates one or more Amazon EC2 instances. You will be billed for the AWS resources
used if you create a stack from this 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 Node.js Application
SampleApplicationVersion:
Type: AWS::ElasticBeanstalk::ApplicationVersion
Properties:
Description: Version 1.0
ApplicationName:
Ref: SampleApplication
SourceBundle:
S3Bucket:
Fn::Join:
- "-"
- - elasticbeanstalk-samples
- Ref: AWS::Region
S3Key: nodejs-sample.zip
SampleConfigurationTemplate:
Type: AWS::ElasticBeanstalk::ConfigurationTemplate
Properties:
ApplicationName:
Ref: SampleApplication
Description: SSH access to Node.JS Application
SolutionStackName: 64bit Amazon Linux 2018.03 v4.7.1 running Node.js
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 Node.js 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 cloudformation package --s3-bucket myan-eat-cloudformation --template-file template.yml --output-template-file template-generated.yaml --profile myan-eat
然后我运行以下命令进行部署。
aws cloudformation deploy --template-file /Users/wai/Desktop/myan-eat/template-generated.yaml --stack-name MyanEat --parameter-overrides KeyName=MyanEat --capabilities CAPABILITY_IAM
然后我遇到以下错误。
Failed to create/update the stack. Run the following command
to fetch the list of events leading up to the failure
aws cloudformation describe-stack-events --stack-name MyanEat
这是我运行提到的命令时得到的
{
"StackEvents": [
{
"StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/MyanEat/1d01be70-bed0-11ea-a830-068f31eb76a4",
"EventId": "8fc77530-bed0-11ea-a830-068f31eb76a4",
"ResourceStatus": "ROLLBACK_COMPLETE",
"ResourceType": "AWS::CloudFormation::Stack",
"Timestamp": "2020-07-05T15:02:36.279Z",
"StackName": "MyanEat",
"PhysicalResourceId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/MyanEat/1d01be70-bed0-11ea-a830-068f31eb76a4",
"LogicalResourceId": "MyanEat"
},
{
"StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/MyanEat/1d01be70-bed0-11ea-a830-068f31eb76a4",
"EventId": "SampleApplication-DELETE_COMPLETE-2020-07-05T15:02:35.626Z",
"ResourceStatus": "DELETE_COMPLETE",
"ResourceType": "AWS::ElasticBeanstalk::Application",
"Timestamp": "2020-07-05T15:02:35.626Z",
"StackName": "MyanEat",
"ResourceProperties": "{\"Description\":\"AWS Elastic Beanstalk Sample Node.js Application\"}",
"PhysicalResourceId": "MyanEat-SampleApplication-1CT11LYW2U9E8",
"LogicalResourceId": "SampleApplication"
},
{
"StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/MyanEat/1d01be70-bed0-11ea-a830-068f31eb76a4",
"EventId": "WebServerRole-DELETE_COMPLETE-2020-07-05T15:02:06.914Z",
"ResourceStatus": "DELETE_COMPLETE",
"ResourceType": "AWS::IAM::Role",
"Timestamp": "2020-07-05T15:02:06.914Z",
"StackName": "MyanEat",
"ResourceProperties": "{\"Path\":\"/\",\"AssumeRolePolicyDocument\":{\"Statement\":[{\"Action\":[\"sts:AssumeRole\"],\"Effect\":\"Allow\",\"Principal\":{\"Service\":[\"ec2.amazonaws.com\"]}}]}}",
"PhysicalResourceId": "MyanEat-WebServerRole-FEGUF1UWDY8E",
"LogicalResourceId": "WebServerRole"
},
{
"StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/MyanEat/1d01be70-bed0-11ea-a830-068f31eb76a4",
"EventId": "WebServerRole-DELETE_IN_PROGRESS-2020-07-05T15:02:05.736Z",
"ResourceStatus": "DELETE_IN_PROGRESS",
"ResourceType": "AWS::IAM::Role",
"Timestamp": "2020-07-05T15:02:05.736Z",
"StackName": "MyanEat",
"ResourceProperties": "{\"Path\":\"/\",\"AssumeRolePolicyDocument\":{\"Statement\":[{\"Action\":[\"sts:AssumeRole\"],\"Effect\":\"Allow\",\"Principal\":{\"Service\":[\"ec2.amazonaws.com\"]}}]}}",
"PhysicalResourceId": "MyanEat-WebServerRole-FEGUF1UWDY8E",
"LogicalResourceId": "WebServerRole"
},
{
"StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/MyanEat/1d01be70-bed0-11ea-a830-068f31eb76a4",
"EventId": "WebServerInstanceProfile-DELETE_COMPLETE-2020-07-05T15:02:05.162Z",
"ResourceStatus": "DELETE_COMPLETE",
"ResourceType": "AWS::IAM::InstanceProfile",
"Timestamp": "2020-07-05T15:02:05.162Z",
"StackName": "MyanEat",
"ResourceProperties": "{\"Path\":\"/\",\"Roles\":[\"MyanEat-WebServerRole-FEGUF1UWDY8E\"]}",
"PhysicalResourceId": "MyanEat-WebServerInstanceProfile-14O10F4FAAL7T",
"LogicalResourceId": "WebServerInstanceProfile"
},
{
"StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/MyanEat/1d01be70-bed0-11ea-a830-068f31eb76a4",
"EventId": "SampleApplication-DELETE_IN_PROGRESS-2020-07-05T15:02:04.845Z",
"ResourceStatus": "DELETE_IN_PROGRESS",
"ResourceType": "AWS::ElasticBeanstalk::Application",
"Timestamp": "2020-07-05T15:02:04.845Z",
"StackName": "MyanEat",
"ResourceProperties": "{\"Description\":\"AWS Elastic Beanstalk Sample Node.js Application\"}",
"PhysicalResourceId": "MyanEat-SampleApplication-1CT11LYW2U9E8",
"LogicalResourceId": "SampleApplication"
},
{
"StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/MyanEat/1d01be70-bed0-11ea-a830-068f31eb76a4",
"EventId": "WebServerRolePolicy-DELETE_COMPLETE-2020-07-05T15:02:04.617Z",
"ResourceStatus": "DELETE_COMPLETE",
"ResourceType": "AWS::IAM::Policy",
"Timestamp": "2020-07-05T15:02:04.617Z",
"StackName": "MyanEat",
"ResourceProperties": "{\"PolicyName\":\"WebServerRole\",\"PolicyDocument\":{\"Statement\":[{\"Resource\":\"*\",\"Effect\":\"Allow\",\"NotAction\":\"iam:*\"}]},\"Roles\":[\"MyanEat-WebServerRole-FEGUF1UWDY8E\"]}",
"PhysicalResourceId": "MyanE-WebS-BYWB87MU5AR6",
"LogicalResourceId": "WebServerRolePolicy"
},
{
"StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/MyanEat/1d01be70-bed0-11ea-a830-068f31eb76a4",
"EventId": "WebServerInstanceProfile-DELETE_IN_PROGRESS-2020-07-05T15:02:04.505Z",
"ResourceStatus": "DELETE_IN_PROGRESS",
"ResourceType": "AWS::IAM::InstanceProfile",
"Timestamp": "2020-07-05T15:02:04.505Z",
"StackName": "MyanEat",
"ResourceProperties": "{\"Path\":\"/\",\"Roles\":[\"MyanEat-WebServerRole-FEGUF1UWDY8E\"]}",
"PhysicalResourceId": "MyanEat-WebServerInstanceProfile-14O10F4FAAL7T",
"LogicalResourceId": "WebServerInstanceProfile"
},
{
"StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/MyanEat/1d01be70-bed0-11ea-a830-068f31eb76a4",
"EventId": "SampleApplicationVersion-DELETE_COMPLETE-2020-07-05T15:02:04.225Z",
"ResourceStatus": "DELETE_COMPLETE",
"ResourceType": "AWS::ElasticBeanstalk::ApplicationVersion",
"Timestamp": "2020-07-05T15:02:04.225Z",
"StackName": "MyanEat",
"ResourceProperties": "{\"Description\":\"Version 1.0\",\"ApplicationName\":\"MyanEat-SampleApplication-1CT11LYW2U9E8\",\"SourceBundle\":{\"S3Bucket\":\"elasticbeanstalk-samples-eu-west-1\",\"S3Key\":\"nodejs-sample.zip\"}}",
"PhysicalResourceId": "myaneat-sampleapplicationversion-168k9owspi8bd",
"LogicalResourceId": "SampleApplicationVersion"
},
{
"StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/MyanEat/1d01be70-bed0-11ea-a830-068f31eb76a4",
"EventId": "SampleConfigurationTemplate-DELETE_COMPLETE-2020-07-05T15:02:03.820Z",
"ResourceStatus": "DELETE_COMPLETE",
"ResourceType": "AWS::ElasticBeanstalk::ConfigurationTemplate",
"Timestamp": "2020-07-05T15:02:03.820Z",
"StackName": "MyanEat",
"ResourceProperties": "{\"ApplicationName\":\"MyanEat-SampleApplication-1CT11LYW2U9E8\",\"Description\":\"SSH access to Node.JS Application\",\"OptionSettings\":[{\"Value\":\"MyanEat\",\"Namespace\":\"aws:autoscaling:launchconfiguration\",\"OptionName\":\"EC2KeyName\"},{\"Value\":\"MyanEat-WebServerInstanceProfile-14O10F4FAAL7T\",\"Namespace\":\"aws:autoscaling:launchconfiguration\",\"OptionName\":\"IamInstanceProfile\"}],\"SolutionStackName\":\"64bit Amazon Linux 2018.03 v4.7.1 running Node.js\"}",
"PhysicalResourceId": "",
"LogicalResourceId": "SampleConfigurationTemplate"
},
{
"StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/MyanEat/1d01be70-bed0-11ea-a830-068f31eb76a4",
"EventId": "SampleApplicationVersion-DELETE_IN_PROGRESS-2020-07-05T15:02:03.809Z",
"ResourceStatus": "DELETE_IN_PROGRESS",
"ResourceType": "AWS::ElasticBeanstalk::ApplicationVersion",
"Timestamp": "2020-07-05T15:02:03.809Z",
"StackName": "MyanEat",
"ResourceProperties": "{\"Description\":\"Version 1.0\",\"ApplicationName\":\"MyanEat-SampleApplication-1CT11LYW2U9E8\",\"SourceBundle\":{\"S3Bucket\":\"elasticbeanstalk-samples-eu-west-1\",\"S3Key\":\"nodejs-sample.zip\"}}",
"PhysicalResourceId": "myaneat-sampleapplicationversion-168k9owspi8bd",
"LogicalResourceId": "SampleApplicationVersion"
},
{
"StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/MyanEat/1d01be70-bed0-11ea-a830-068f31eb76a4",
"EventId": "WebServerRolePolicy-DELETE_IN_PROGRESS-2020-07-05T15:02:03.808Z",
"ResourceStatus": "DELETE_IN_PROGRESS",
"ResourceType": "AWS::IAM::Policy",
"Timestamp": "2020-07-05T15:02:03.808Z",
"StackName": "MyanEat",
"ResourceProperties": "{\"PolicyName\":\"WebServerRole\",\"PolicyDocument\":{\"Statement\":[{\"Resource\":\"*\",\"Effect\":\"Allow\",\"NotAction\":\"iam:*\"}]},\"Roles\":[\"MyanEat-WebServerRole-FEGUF1UWDY8E\"]}",
"PhysicalResourceId": "MyanE-WebS-BYWB87MU5AR6",
"LogicalResourceId": "WebServerRolePolicy"
},
{
"StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/MyanEat/1d01be70-bed0-11ea-a830-068f31eb76a4",
"EventId": "76b54e50-bed0-11ea-967d-06527026dd82",
"ResourceStatus": "ROLLBACK_IN_PROGRESS",
"ResourceType": "AWS::CloudFormation::Stack",
"Timestamp": "2020-07-05T15:01:54.217Z",
"ResourceStatusReason": "The following resource(s) failed to create: [SampleConfigurationTemplate]. . Rollback requested by user.",
"StackName": "MyanEat",
"PhysicalResourceId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/MyanEat/1d01be70-bed0-11ea-a830-068f31eb76a4",
"LogicalResourceId": "MyanEat"
},
{
"StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/MyanEat/1d01be70-bed0-11ea-a830-068f31eb76a4",
"EventId": "SampleConfigurationTemplate-CREATE_FAILED-2020-07-05T15:01:53.497Z",
"ResourceStatus": "CREATE_FAILED",
"ResourceType": "AWS::ElasticBeanstalk::ConfigurationTemplate",
"Timestamp": "2020-07-05T15:01:53.497Z",
"ResourceStatusReason": "No Solution Stack named '64bit Amazon Linux 2018.03 v4.7.1 running Node.js' found. (Service: AWSElasticBeanstalk; Status Code: 400; Error Code: InvalidParameterValue; Request ID: 7877ee26-c7ef-4b32-8713-056f9263c1d8)",
"StackName": "MyanEat",
"ResourceProperties": "{\"ApplicationName\":\"MyanEat-SampleApplication-1CT11LYW2U9E8\",\"Description\":\"SSH access to Node.JS Application\",\"OptionSettings\":[{\"Value\":\"MyanEat\",\"Namespace\":\"aws:autoscaling:launchconfiguration\",\"OptionName\":\"EC2KeyName\"},{\"Value\":\"MyanEat-WebServerInstanceProfile-14O10F4FAAL7T\",\"Namespace\":\"aws:autoscaling:launchconfiguration\",\"OptionName\":\"IamInstanceProfile\"}],\"SolutionStackName\":\"64bit Amazon Linux 2018.03 v4.7.1 running Node.js\"}",
"PhysicalResourceId": "",
"LogicalResourceId": "SampleConfigurationTemplate"
},
{
"StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/MyanEat/1d01be70-bed0-11ea-a830-068f31eb76a4",
"EventId": "SampleConfigurationTemplate-CREATE_IN_PROGRESS-2020-07-05T15:01:53.221Z",
"ResourceStatus": "CREATE_IN_PROGRESS",
"ResourceType": "AWS::ElasticBeanstalk::ConfigurationTemplate",
"Timestamp": "2020-07-05T15:01:53.221Z",
"StackName": "MyanEat",
"ResourceProperties": "{\"ApplicationName\":\"MyanEat-SampleApplication-1CT11LYW2U9E8\",\"Description\":\"SSH access to Node.JS Application\",\"OptionSettings\":[{\"Value\":\"MyanEat\",\"Namespace\":\"aws:autoscaling:launchconfiguration\",\"OptionName\":\"EC2KeyName\"},{\"Value\":\"MyanEat-WebServerInstanceProfile-14O10F4FAAL7T\",\"Namespace\":\"aws:autoscaling:launchconfiguration\",\"OptionName\":\"IamInstanceProfile\"}],\"SolutionStackName\":\"64bit Amazon Linux 2018.03 v4.7.1 running Node.js\"}",
"PhysicalResourceId": "",
"LogicalResourceId": "SampleConfigurationTemplate"
},
{
"StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/MyanEat/1d01be70-bed0-11ea-a830-068f31eb76a4",
"EventId": "WebServerInstanceProfile-CREATE_COMPLETE-2020-07-05T15:01:51.611Z",
"ResourceStatus": "CREATE_COMPLETE",
"ResourceType": "AWS::IAM::InstanceProfile",
"Timestamp": "2020-07-05T15:01:51.611Z",
"StackName": "MyanEat",
"ResourceProperties": "{\"Path\":\"/\",\"Roles\":[\"MyanEat-WebServerRole-FEGUF1UWDY8E\"]}",
"PhysicalResourceId": "MyanEat-WebServerInstanceProfile-14O10F4FAAL7T",
"LogicalResourceId": "WebServerInstanceProfile"
},
{
"StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/MyanEat/1d01be70-bed0-11ea-a830-068f31eb76a4",
"EventId": "WebServerRolePolicy-CREATE_COMPLETE-2020-07-05T15:00:05.734Z",
"ResourceStatus": "CREATE_COMPLETE",
"ResourceType": "AWS::IAM::Policy",
"Timestamp": "2020-07-05T15:00:05.734Z",
"StackName": "MyanEat",
"ResourceProperties": "{\"PolicyName\":\"WebServerRole\",\"PolicyDocument\":{\"Statement\":[{\"Resource\":\"*\",\"Effect\":\"Allow\",\"NotAction\":\"iam:*\"}]},\"Roles\":[\"MyanEat-WebServerRole-FEGUF1UWDY8E\"]}",
"PhysicalResourceId": "MyanE-WebS-BYWB87MU5AR6",
"LogicalResourceId": "WebServerRolePolicy"
},
{
"StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/MyanEat/1d01be70-bed0-11ea-a830-068f31eb76a4",
"EventId": "WebServerRolePolicy-CREATE_IN_PROGRESS-2020-07-05T14:59:51.553Z",
"ResourceStatus": "CREATE_IN_PROGRESS",
"ResourceType": "AWS::IAM::Policy",
"Timestamp": "2020-07-05T14:59:51.553Z",
"ResourceStatusReason": "Resource creation Initiated",
"StackName": "MyanEat",
"ResourceProperties": "{\"PolicyName\":\"WebServerRole\",\"PolicyDocument\":{\"Statement\":[{\"Resource\":\"*\",\"Effect\":\"Allow\",\"NotAction\":\"iam:*\"}]},\"Roles\":[\"MyanEat-WebServerRole-FEGUF1UWDY8E\"]}",
"PhysicalResourceId": "MyanE-WebS-BYWB87MU5AR6",
"LogicalResourceId": "WebServerRolePolicy"
},
{
"StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/MyanEat/1d01be70-bed0-11ea-a830-068f31eb76a4",
"EventId": "WebServerInstanceProfile-CREATE_IN_PROGRESS-2020-07-05T14:59:51.046Z",
"ResourceStatus": "CREATE_IN_PROGRESS",
"ResourceType": "AWS::IAM::InstanceProfile",
"Timestamp": "2020-07-05T14:59:51.046Z",
"ResourceStatusReason": "Resource creation Initiated",
"StackName": "MyanEat",
"ResourceProperties": "{\"Path\":\"/\",\"Roles\":[\"MyanEat-WebServerRole-FEGUF1UWDY8E\"]}",
"PhysicalResourceId": "MyanEat-WebServerInstanceProfile-14O10F4FAAL7T",
"LogicalResourceId": "WebServerInstanceProfile"
},
{
"StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/MyanEat/1d01be70-bed0-11ea-a830-068f31eb76a4",
"EventId": "WebServerRolePolicy-CREATE_IN_PROGRESS-2020-07-05T14:59:50.596Z",
"ResourceStatus": "CREATE_IN_PROGRESS",
"ResourceType": "AWS::IAM::Policy",
"Timestamp": "2020-07-05T14:59:50.596Z",
"StackName": "MyanEat",
"ResourceProperties": "{\"PolicyName\":\"WebServerRole\",\"PolicyDocument\":{\"Statement\":[{\"Resource\":\"*\",\"Effect\":\"Allow\",\"NotAction\":\"iam:*\"}]},\"Roles\":[\"MyanEat-WebServerRole-FEGUF1UWDY8E\"]}",
"PhysicalResourceId": "",
"LogicalResourceId": "WebServerRolePolicy"
},
{
"StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/MyanEat/1d01be70-bed0-11ea-a830-068f31eb76a4",
"EventId": "WebServerInstanceProfile-CREATE_IN_PROGRESS-2020-07-05T14:59:50.457Z",
"ResourceStatus": "CREATE_IN_PROGRESS",
"ResourceType": "AWS::IAM::InstanceProfile",
"Timestamp": "2020-07-05T14:59:50.457Z",
"StackName": "MyanEat",
"ResourceProperties": "{\"Path\":\"/\",\"Roles\":[\"MyanEat-WebServerRole-FEGUF1UWDY8E\"]}",
"PhysicalResourceId": "",
"LogicalResourceId": "WebServerInstanceProfile"
},
{
"StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/MyanEat/1d01be70-bed0-11ea-a830-068f31eb76a4",
"EventId": "WebServerRole-CREATE_COMPLETE-2020-07-05T14:59:48.596Z",
"ResourceStatus": "CREATE_COMPLETE",
"ResourceType": "AWS::IAM::Role",
"Timestamp": "2020-07-05T14:59:48.596Z",
"StackName": "MyanEat",
"ResourceProperties": "{\"Path\":\"/\",\"AssumeRolePolicyDocument\":{\"Statement\":[{\"Action\":[\"sts:AssumeRole\"],\"Effect\":\"Allow\",\"Principal\":{\"Service\":[\"ec2.amazonaws.com\"]}}]}}",
"PhysicalResourceId": "MyanEat-WebServerRole-FEGUF1UWDY8E",
"LogicalResourceId": "WebServerRole"
},
{
"StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/MyanEat/1d01be70-bed0-11ea-a830-068f31eb76a4",
"EventId": "SampleApplicationVersion-CREATE_COMPLETE-2020-07-05T14:59:36.690Z",
"ResourceStatus": "CREATE_COMPLETE",
"ResourceType": "AWS::ElasticBeanstalk::ApplicationVersion",
"Timestamp": "2020-07-05T14:59:36.690Z",
"StackName": "MyanEat",
"ResourceProperties": "{\"Description\":\"Version 1.0\",\"ApplicationName\":\"MyanEat-SampleApplication-1CT11LYW2U9E8\",\"SourceBundle\":{\"S3Bucket\":\"elasticbeanstalk-samples-eu-west-1\",\"S3Key\":\"nodejs-sample.zip\"}}",
"PhysicalResourceId": "myaneat-sampleapplicationversion-168k9owspi8bd",
"LogicalResourceId": "SampleApplicationVersion"
},
{
"StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/MyanEat/1d01be70-bed0-11ea-a830-068f31eb76a4",
"EventId": "SampleApplicationVersion-CREATE_IN_PROGRESS-2020-07-05T14:59:36.536Z",
"ResourceStatus": "CREATE_IN_PROGRESS",
"ResourceType": "AWS::ElasticBeanstalk::ApplicationVersion",
"Timestamp": "2020-07-05T14:59:36.536Z",
"ResourceStatusReason": "Resource creation Initiated",
"StackName": "MyanEat",
"ResourceProperties": "{\"Description\":\"Version 1.0\",\"ApplicationName\":\"MyanEat-SampleApplication-1CT11LYW2U9E8\",\"SourceBundle\":{\"S3Bucket\":\"elasticbeanstalk-samples-eu-west-1\",\"S3Key\":\"nodejs-sample.zip\"}}",
"PhysicalResourceId": "myaneat-sampleapplicationversion-168k9owspi8bd",
"LogicalResourceId": "SampleApplicationVersion"
},
{
"StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/MyanEat/1d01be70-bed0-11ea-a830-068f31eb76a4",
"EventId": "SampleApplicationVersion-CREATE_IN_PROGRESS-2020-07-05T14:59:35.841Z",
"ResourceStatus": "CREATE_IN_PROGRESS",
"ResourceType": "AWS::ElasticBeanstalk::ApplicationVersion",
"Timestamp": "2020-07-05T14:59:35.841Z",
"StackName": "MyanEat",
"ResourceProperties": "{\"Description\":\"Version 1.0\",\"ApplicationName\":\"MyanEat-SampleApplication-1CT11LYW2U9E8\",\"SourceBundle\":{\"S3Bucket\":\"elasticbeanstalk-samples-eu-west-1\",\"S3Key\":\"nodejs-sample.zip\"}}",
"PhysicalResourceId": "",
"LogicalResourceId": "SampleApplicationVersion"
},
{
"StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/MyanEat/1d01be70-bed0-11ea-a830-068f31eb76a4",
"EventId": "SampleApplication-CREATE_COMPLETE-2020-07-05T14:59:34.066Z",
"ResourceStatus": "CREATE_COMPLETE",
"ResourceType": "AWS::ElasticBeanstalk::Application",
"Timestamp": "2020-07-05T14:59:34.066Z",
"StackName": "MyanEat",
"ResourceProperties": "{\"Description\":\"AWS Elastic Beanstalk Sample Node.js Application\"}",
"PhysicalResourceId": "MyanEat-SampleApplication-1CT11LYW2U9E8",
"LogicalResourceId": "SampleApplication"
},
{
"StackId": "arn:aws:cloudformation:eu-west-1:733553390213:stack/MyanEat/1d01be70-bed0-11ea-a830-068f31eb76a4",
"EventId": "SampleApplication-CREATE_IN_PROGRESS-2020-07-05T14:59:33.710Z",
"ResourceStatus": "CREATE_IN_PROGRESS",
"ResourceType": "AWS::ElasticBeanstalk::Application",
"Timestamp": "2020-07-05T14:59:33.710Z",
"ResourceStatusReason": "Resource creation Initiated",
"StackName": "MyanEat",
"ResourceProperties": "{\"Description\":\"AWS Elastic Beanstalk Sample Node.js Application\"}",
.........
}
我的代码有什么问题,我该如何解决?
答案 0 :(得分:2)
问题归结于此错误No Solution Stack named '64bit Amazon Linux 2018.03 v4.7.1 running Node.js' found.
。
64bit Amazon Linux 2 v5.1.0 running Node.js 12
64bit Amazon Linux 2 v5.1.0 running Node.js 10
64bit Amazon Linux 2018.03 v4.15.0 running Node.js
为应用程序选择合适的值后,请为SolutionStackName
资源的SampleConfigurationTemplate
属性输入其值。
我已将其更新为64bit Amazon Linux 2018.03 v4.15.0 running Node.js
(它看起来与您要部署的内容最接近),并且可以确认它可以与以下模板一起使用
---
AWSTemplateFormatVersion: '2010-09-09'
Description: 'AWS CloudFormation Sample Template ElasticBeanstalk_Nodejs_Sample: Configure
and launch the AWS Elastic Beanstalk sample application. **WARNING** This template
creates one or more Amazon EC2 instances. You will be billed for the AWS resources
used if you create a stack from this 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 Node.js Application
SampleApplicationVersion:
Type: AWS::ElasticBeanstalk::ApplicationVersion
Properties:
Description: Version 1.0
ApplicationName:
Ref: SampleApplication
SourceBundle:
S3Bucket:
Fn::Join:
- "-"
- - elasticbeanstalk-samples
- Ref: AWS::Region
S3Key: nodejs-sample.zip
SampleConfigurationTemplate:
Type: AWS::ElasticBeanstalk::ConfigurationTemplate
Properties:
ApplicationName:
Ref: SampleApplication
Description: SSH access to Node.JS Application
SolutionStackName: 64bit Amazon Linux 2018.03 v4.15.0 running Node.js
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 Node.js 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