官术网_书友最值得收藏!

Provisioning EC2 instances

Here, we will be provisioning instances in us-west-1, but depending on where you have your AWS instances set up, you will need to change your knife.rb configuration to specify the region of your choice.

In order for them to communicate securely, we will construct a security group so that all traffic between them is permitted. This is outside the scope of this book, but it would be something to make sure you configure for production systems, as you probably do not want the public on the Internet to have direct access to your database server.

Here, we will assume that you have your AWS credentials and other critical components configured, as we covered in previous chapters.

To provision our database server, we will use the following command:

knife ec2 server create -d ubuntu14.04 -I ami-ee4f77ab -f m1.small -Z us-west-1a -S jewartec2 -N db00 --ssh-user ubuntu

And to provision the web server, we will use the following command:

knife ec2 server create -d ubuntu14.04 -I ami-ee4f77ab -f m1.small -Z us-west-1a -S jewartec2 -N web00 --ssh-user ubuntu

Once your instances are up and running, you can now move on to configuring them with the roles and configuration data required!

Configuring the database host

In order to apply the PostgreSQL role to our database host, we need to make sure it's in the run list. We can accomplish this with the following command:

knife node run_list add db00 "role[base_server]" 
knife node run_list add db00 "role[postgresql_server]"

After ensuring that your node has the base_server and postgresql_server roles added to the run list, you can run chef-client on the newly created host:

[jewart]% knife ssh 'name:db00' -x ubuntu 'sudo chef-client'

Once this is complete, assuming that everything went well, your new EC2 instance will have:

  • PostgreSQL 9.3 server installed and running
  • A new database (the name of which is defined from your configuration)
  • A database user that is granted permission to connect
  • Correct pg_hba.conf and postgresql.conf files for our service

Now that we have our database server configured, which can be verified by logging onto the server and ensuring that the service is running, let's take a look at setting up our web application.

主站蜘蛛池模板: 乌拉特后旗| 青阳县| 天等县| 湖口县| 阿图什市| 唐海县| 罗江县| 杂多县| 正定县| 二连浩特市| 江津市| 循化| 隆安县| 新晃| 东乌珠穆沁旗| 祥云县| 綦江县| 义马市| 南丰县| 无锡市| 甘孜县| 庆安县| 韶山市| 双鸭山市| 湖南省| 宁海县| 德江县| 景泰县| 神池县| 雅安市| 安泽县| 玛纳斯县| 慈溪市| 长岛县| 运城市| 垦利县| 长寿区| 左权县| 焦作市| 汉中市| 游戏|