How to set up apache server remotely on EC2 instance using Chef

46 views Asked by At

I am currently using chef-solo to run the following code that sets up a simple apache web server with the following code:

service 'httpd' do
  action [:enable, :start]
end

file '/var/www/html/index.html' do
  content '<html>
  <body>
    <h1>Apache server.</h1>
  </body>
</html>

I run the command sudo chef-solo -c solo.rb -j web.json to run this code. The server runs as expected locally. I now want to be able to deploy and provision the apache server on an EC2 instance I already have set up and can access over SSH. What amendments do I need to make to my code in order to make this happen?

Please ask if you need any more clarity in what I'm asking for. Thanks in advance.

Content of solo.rb:

file_cache_path "/var/chef/cache"
cookbook_path "/home/caleb.whittington/chef-repo"

Content of web.json:

{
  "run_list": [ "recipe[apache]" ]
}
0

There are 0 answers