gpt4 book ai didi

amazon-ec2 - 使用路由 53 创建 RDS cloudformation

转载 作者:行者123 更新时间:2023-12-03 07:42:49 25 4
gpt4 key购买 nike

我在 AWS 云形成方面遇到问题。我需要创建 cloudformation,它将使用 RHEL 安装和配置 RDS,并使用路由 53 和主用户配置 mariadb。我首先从基本的 config.yaml 开始,但我遇到了 vpc 错误,它说

No default VPC for this user (Service: AmazonEC2; Status Code: 400; Error Code: VPCIdNotSpecified; Request ID: 407bd74c-9b85-4cce-b5a7-b816fe7aea15)

我的config.yaml是这样的

Resources:
Ec2Instance1:
Type: 'AWS::EC2::Instance'
Properties:
SecurityGroups:
- !Ref InstanceSecurityGroup
KeyName: adivir
ImageId: ami-07dfba995513840b5
AvailabilityZone: eu-central-1
InstanceType: t2.micro
UserData:
Fn::Base64: !Sub |
#!/bin/bash -xe
yum install -y httpd
yum install -y git
yum install -y php php-mysql
git clone https://github.com/demoglot/php.git /var/www/html
systemctl restart httpd
systemctl enable httpd
Ec2Instance2:
Type: 'AWS::EC2::Instance'
Properties:
SecurityGroups:
- !Ref InstanceSecurityGroup
KeyName: adivir
ImageId: ami-07dfba995513840b5
AvailabilityZone: eu-central-1
InstanceType: t2.micro
UserData:
Fn::Base64: !Sub |
#!/bin/bash -xe
yum install -y httpd
yum install git -y
git clone https://github.com/demoglot/php.git /var/www/html
systemctl restart httpd
systemctl enable httpd
InstanceSecurityGroup:
Type: 'AWS::EC2::SecurityGroup'
Properties:
GroupDescription: Enable SSH access
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: '2256'
ToPort: '2256'
CidrIp: 0.0.0.0/0

- IpProtocol: tcp
FromPort: '80'
ToPort: '80'
CidrIp: 0.0.0.0/0
ElasticLoadBalancer:
Type: 'AWS::ElasticLoadBalancing::LoadBalancer'
Properties:
AvailabilityZones:
- eu-central-1
- eu-central-1b
Listeners:
- InstancePort: '80'
LoadBalancerPort: '80'
Protocol: HTTP
HealthCheck:
Target: 'HTTP:80/'
HealthyThreshold: '3'
UnhealthyThreshold: '5'
Interval: '30'
Timeout: '5'
Instances :
- !Ref Ec2Instance1
- !Ref Ec2Instance2
DBSECURITYGROUP:
Type: 'AWS::RDS::DBSecurityGroup'
Properties:
GroupDescription: Security Group for RDS private access
DBSecurityGroupIngress:
- CIDRIP: 0.0.0.0/0
MyDB:
Type: 'AWS::RDS::DBInstance'
Properties:
DBName: kk
AllocatedStorage: '20'
DBInstanceClass: db.t2.micro
Engine: MariaDB
EngineVersion: '10.1.31'
MasterUsername: admin
MasterUserPassword: admin123
DBSecurityGroups:
- !Ref DBSECURITYGROUP
Tags:
- Key: name
Value: kk
DeletionPolicy: Snapshot

我需要做什么才能解决 vpc 错误并成功创建 RDS,以及如何以及在何处在 yaml 文件中添加路由 53 创建?数据库也需要连接到其他实例上的java应用程序。我需要与制作应用程序的人分享什么才能让他连接到数据库?另外,是否可以有一个 shell 脚本来按顺序运行 cloudformations,创建堆栈然后退出,这样就不需要每个团队成员都需要运行自己的云编队了?谢谢

最佳答案

此问题的解决方案及其发生原因已在最近的 AWS 博客中记录和解释:

基本上,解决方案是创建新的默认 vpc。

附:

我也同意@mokugo-devops。您提出了太多的子问题,这限制了您报告的主要问题和问题的焦点和准确性。

关于amazon-ec2 - 使用路由 53 创建 RDS cloudformation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61753850/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com