我希望 Vagrant 每次执行 vagrant up 时都在 /vagrant/ 文件夹中启动 Play 服务器。将 @reboot 放在 crontab 上不起作用,因为脚本在连接 /vagrant/ 文件夹之前运行。
我有一个带有两个私有子网的 VPC(需要两个子网才能设置 RDS 实例)。我有这个 VPC 的安全组,我们称之为vpc-sg
。vpc-sg
允许从我的家用机器在端口 22 上进行 TCP 访问,并允许所有出站流量。就是这样。
我在 VPC 内启动了一个面向公众的 EC2 服务器,我已将公共弹性 IP 附加到该服务器。我正在使用 EIP ssh 进入这个 EC2 服务器。我将安全组设置为vpc-sg
. 我在 EC2 实例上安装了 PostgreSQL 9.2。
我在同一个 VPC 中有一个 RDS 实例。它也vpc-sg
用于安全组。创建实例时,我被迫选择 PostgreSQL 9.3 版。我尝试从我的 EC2 实例访问 RDS PostgreSQL 数据库:
[ec2-user@ip-10-0-0-20 ~]$ psql the_db_name -U the_db_username -h my-db-instance.random-string.us-east-1.rds.amazonaws.com -p 5432 -W
Password for user the_db_username:
psql: could not connect to server: Connection timed out
Is the server running on host "my-db-instance.random-string.us-east-1.rds.amazonaws.com" (10.0.0.147) …
Run Code Online (Sandbox Code Playgroud)