我在启用 https 协议的情况下为 beanstalk 设置 cloudformation 时遇到问题。
这是我的配置设置:
configurationTemplateUI:
Type: AWS::ElasticBeanstalk::ConfigurationTemplate
DependsOn: BeanstalkAppUI
Properties:
ApplicationName:
Ref: BeanstalkAppUI
Description: AWS ElasticBeanstalk Sample Configuration Template
OptionSettings:
- Namespace: aws:autoscaling:asg
OptionName: MinSize
Value:
Ref: MinEc2s
- Namespace: aws:autoscaling:asg
OptionName: MaxSize
Value:
Ref: MaxEc2s
- Namespace: aws:elasticbeanstalk:environment
OptionName: EnvironmentType
Value: LoadBalanced
- Namespace: aws:autoscaling:launchconfiguration
OptionName: InstanceType
Value:
Ref: InstanceType
- Namespace: aws:ec2:vpc
OptionName: VPCId
Value:
Fn::ImportValue: !Sub ${BusinessUnit}-${EnvironmentInfra}-vpc-VpcId
- Namespace: aws:ec2:vpc
OptionName: Subnets
Value:
Fn::ImportValue: !Sub ${BusinessUnit}-${EnvironmentInfra}-vpc-SubnetIdPrivate${SubnetAvNumber}
- Namespace: aws:ec2:vpc
OptionName: ELBSubnets
Value:
Fn::ImportValue: …Run Code Online (Sandbox Code Playgroud) amazon-web-services aws-cloudformation aws-opsworks amazon-elastic-beanstalk
我尝试使用 cloudformation 将多个 EBS 卷安装到我的 EC2 实例,但由于某种原因,仅安装了我指定的最后一个 EBS 卷。
EG:
NewEC2Instance:
Type: AWS::EC2::Instance
DependsOn: OldSecurityGroup
Properties:
ImageId: !Ref pImageId
InstanceType: !Ref pInstanceType
BlockDeviceMappings:
-
DeviceName: /dev/sda1
Ebs:
VolumeSize: 10
DeviceName: /dev/sdf
Ebs:
VolumeSize: 11
Encrypted: true
DeviceName: /dev/sdg
Ebs:
VolumeSize: 12
Encrypted: true
DeviceName: /dev/sdh
Ebs:
VolumeSize: 100
Encrypted: true
Run Code Online (Sandbox Code Playgroud)
对于上面的代码,仅创建 100Gb /dev/sdh。
我认为 Cloudformation 正在覆盖 EBS 卷。
有人知道为什么吗?请帮忙!
amazon-ec2 amazon-ebs amazon-web-services aws-cloudformation
我正在使用 ECS 服务创建 Cloudformation 堆栈。如果我将DesiredCount值设置为 1,堆栈就会完成创建。
但是当我将计数增加到 2 时,我仍然发现只有一个任务正在运行。任务运行正常,没有错误,但 cloudformation 卡在 CREATE_IN_PROGRESS 状态,一段时间后表明 ECS 服务无法稳定。可能是因为它未能生成剩余的所需任务。
这种行为的原因可能是什么?
有一个 vpc 定义
const vpc = new ec2.Vpc(this, 'SomeVPC', {
cidr: '10.0.0.0/16',
maxAzs: 2,
});
Run Code Online (Sandbox Code Playgroud)
它在底层为 NAT 网关创建 2 个 EIP
"SomeVPCPublicSubnet1EIP58E3D6C5": {
"Type": "AWS::EC2::EIP",
"Properties": {
"Domain": "vpc"
}
}
Run Code Online (Sandbox Code Playgroud)
如何获取对它们的引用并通过导出CfnOutput?像这样的东西:
new CfnOutput(this, "ExternalIPOutput", {value: <some magic call to get SomeVPCPublicSubnet1EIP58E3D6C5.ref()>})
Run Code Online (Sandbox Code Playgroud) 我是 DynamoDb 的新手,我确实查看了 AWS 文档以及一些有关 Hash 和 Range 键的问题。毕竟,我仍然不确定它们的确切含义以及您为什么/如何使用它们。有人可以用一个例子给我一个简单的解释吗?
例如,如果我想创建一个Movie有桌子Name,Genre,Rating和DateReleased列。创建 DynamoDb 表的正确方法是什么。在下面的示例中,我有一些 CloudFormation 来尝试创建以下内容,但我不确定我是否正确使用了 KeySchema 属性。任何帮助,将不胜感激。
MovieTable:
Type: AWS::DynamoDB::Table
Properties:
BillingMode: PAY_PER_REQUEST
AttributeDefinitions:
- AttributeName: "Name"
AttributeType: "S"
- AttributeName: "Genre"
AttributeType: "S"
- AttributeName: "Rating"
AttributeType: "N"
- AttributeName: "DateReleased"
AttributeType: "S"
KeySchema:
- AttributeName: "Name"
KeyType: "HASH"
- AttributeName: "Genre"
KeyType: "RANGE"
- AttributeName: "Rating"
KeyType: "RANGE"
- AttributeName: "DateReleased"
KeyType: "RANGE"
TimeToLiveSpecification:
AttributeName: ExpireAfter
Enabled: false
SSESpecification: …Run Code Online (Sandbox Code Playgroud) amazon-web-services node.js aws-cloudformation amazon-dynamodb
我使用以下方法成功创建了以下四个资源Cloud Formation Template (CFT):
现在,我正在尝试使用 EC2 实例创建一个安全组,这是代码。
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Allow http and ssh to client host
VpcId:
Ref: InsuranceVPC
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: 80
ToPort: 80
CidrIp: 0.0.0.0/0
- IpProtocol: tcp
FromPort: 22
ToPort: 22
CidrIp: 0.0.0.0/0
SecurityGroupEgress:
- IpProtocol: tcp
FromPort: 80
ToPort: 80
CidrIp: 0.0.0.0/0
Ec2Instance:
Type: AWS::EC2::Instance
Properties:
ImageId: "ami-08706cb5f68222d09"
KeyName:
Ref: "DevOpsAutomation"
NetworkInterfaces:
- AssociatePublicIpAddress: "true"
DeviceIndex: "0"
GroupSet:
- Ref: "InsuranceSecurityGroup"
SubnetId:
Ref: "InsuranceSubnet"
Run Code Online (Sandbox Code Playgroud)
但是,当我在(CFT,如上所示,代码)中使用 Key …
amazon-ec2 amazon-web-services aws-cloudformation aws-cloudformation-custom-resource
我正在通过 AWS CLI 运行我的云形成模板。它工作正常并在 AWS 门户上创建堆栈,但我面临一个问题,即无法更改默认参数值。我使用 CLI 传递我自己的参数,但只有最后一个参数值从堆栈中发生变化(即 30),其余的没有变化,而是从模板主体中选择默认值。我已经通过更改参数的位置尝试了所有可能的方法,但它仍然相同。所以请让我知道我将如何解决这个恼人的问题。这是我的命令:-
aws --region eu-north-1 cloudformation create-stack --stack-name cli4 --template-body file://app_cli.json --parameters "ParameterKey"="Maxvalue","ParameterValue"="7","ParameterKey"="increment","ParameterValue"="1","ParameterKey"="incrementtime","ParameterValue"="30"
"Parameters": {
"EnvironmentName": {
"Description": "An environment name that will be prefixed to resource names",
"Type": "String",
"Default": "Codavel"
},
"amiID": {
"Description": "Put ami-id in this",
"Type": "String",
"Default": "ami-085045326daf7e309"
},
"Maxvalue": {
"Description": "Put max value in this",
"Type": "String",
"Default": "100"
},
"increment": {
"Description": "Put No. of incremental instance this",
"Type": "String",
"Default": "2"
},
"incrementtime": …Run Code Online (Sandbox Code Playgroud) amazon-web-services aws-cloudformation aws-cli devops aws-cloudformation-custom-resource
我正在尝试访问使用 aws 控制台创建的 IAM 角色。该角色很简单,因为我必须提供 ecs taskexcutionrole,以便它有权从 ECR 中提取映像。我已经想出了这段代码,我在这段代码中缺少什么?
Role:
Type: 'AWS::IAM::Role'
Properties:
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service:
- ec2.amazonaws.com
Action:
- 'sts:AssumeRole'
Path: /
ManagedPolicyArns:
- arn:aws:iam::02004621356:role/ecs-ec2-task
Run Code Online (Sandbox Code Playgroud)
2- 如果我想创建一个新的任务执行角色并仅授予从 ECR 提取映像的权限,我应该进行哪些更改?
amazon-web-services amazon-ecs aws-cloudformation amazon-iam
我正在尝试创建一个运行 MySQL 数据库的 RDS 服务器并收到以下错误:
1 validation error detected: Value '[AWS:RDS::DBInstance]' at 'typeNameList' failed to satisfy constraint: Member must satisfy constraint: [Member must have length less than or equal to 204, Member must have length greater than or equal to 10, Member must satisfy regular expression pattern: [A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}(::MODULE){0,1}]
AWSTemplateFormatVersion: 2010-09-09
Parameters:
DBName:
Type: String
AllowedPattern: '[a-zA-Z][a-zA-Z0-9]*'
MUser:
Type: String
AllowedPattern: '[a-zA-Z][a-zA-Z0-9]*'
MPass:
Type: String
AllowedPattern: '[a-zA-Z0-9]*'
Description: "It shouldn't be less than 8 characters"
Resources:
MyDBInstance:
Type: AWS:RDS::DBInstance
Properties:
DBName: …Run Code Online (Sandbox Code Playgroud) amazon-ec2 ×3
amazon-ecs ×2
aws-cloudformation-custom-resource ×2
amazon-ebs ×1
amazon-iam ×1
amazon-rds ×1
amazon-s3 ×1
aws-cdk ×1
aws-cli ×1
aws-opsworks ×1
devops ×1
node.js ×1