{"id":13905936,"url":"https://github.com/nrako/librarian-ec2","last_synced_at":"2025-04-19T17:02:41.328Z","repository":{"id":3431769,"uuid":"4483778","full_name":"nrako/librarian-ec2","owner":"nrako","description":"Use your Vagrant Chef Librarian config to provision EC2 with Chef-solo","archived":false,"fork":false,"pushed_at":"2013-03-08T18:44:24.000Z","size":250,"stargazers_count":30,"open_issues_count":0,"forks_count":6,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-11-25T14:47:03.664Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nrako.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-05-29T15:23:12.000Z","updated_at":"2022-01-13T22:13:44.000Z","dependencies_parsed_at":"2022-09-12T15:51:15.989Z","dependency_job_id":null,"html_url":"https://github.com/nrako/librarian-ec2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nrako%2Flibrarian-ec2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nrako%2Flibrarian-ec2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nrako%2Flibrarian-ec2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nrako%2Flibrarian-ec2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nrako","download_url":"https://codeload.github.com/nrako/librarian-ec2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229345342,"owners_count":18058474,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-06T23:01:26.722Z","updated_at":"2024-12-12T07:11:31.170Z","avatar_url":"https://github.com/nrako.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# Librarian-EC2\n\nShell scipts to provision an EC2 instance from an existing Vagrantfile ([Vagrant](http://vagrantup.com)) and Cheffile ([Librarian](https://github.com/applicationsonline/librarian)) config files.\n\nThis project is inspired by [vagrant-ec2](https://github.com/lynaghk/vagrant-ec2/) (and [vagrant-ec2-r](https://github.com/wch/vagrant-ec2-r)) but works with coobooks with dependencies by relying on [Librarian](https://github.com/applicationsonline/librarian).\n\nIt's an easy solution for provisionning and EC2 instance.\n\nThese scripts have been tested only on Mac OS X 10.7 but should works on many unix based system, and if it's note the case, the script is simple fix it and make a pull request ;)\n\n## Requirements\n\n* [VirtualBox 4](http://www.virtualbox.org/wiki/Downloads)\n* [Vagrant](http://vagrantup.com) (`gem install vagrant`)\n* [Librarian](https://github.com/applicationsonline/librarian) (`gem install librarian`)\n* [EC2 API Tools](http://aws.amazon.com/developertools/351)\n\n## Introduction to Vagrant and Librarian\nIf you need an developer-centric introduction to Vagrant and Librarian please refer to my posts on tumblr [tumblr.nrako.com/tagged/vagrant](http://tumblr.nrako.com/tagged/vagrant).\n\n## Provisoning EC2\n\n### Requirements\n\nOn your local machine, you will need the following:\n\n* [AWS EC2 API Tools](http://aws.amazon.com/developertools/3519) installed and setup, try [google](https://www.google.com/search?q=setup+aws+ec2+api+tools) to find help for the setup.\n* The JSON Ruby gem:\n\n  ```\n  gem install --user-install json\n  ```\n\n* Create a key pair in the appropriate region if you don't have one. In our example the region is `us-west-1`, and we'll use the name `ec2-us-west-1-keypair`:\n\n  ```\n  ec2-add-keypair --region us-west-1 ec2-us-west-1-keypair \u003e ~/.ec2/ec2-us-west-1-keypair\n  chmod 600 ~/.ec2/ec2-us-west-1-keypair\n  ```\n\n  Note : ubuntu on us-east-1 has some [temporary issue as today (29th Mai 2012)](https://forums.aws.amazon.com/thread.jspa?threadID=95616)\n\n\n### Create and provision an EC2 instance machine\n\nDo the following each time you want to create a virtual machine on EC2.\n\nStart up a new EC2 instance (`ami-87712ac2` is a Ubuntu 12.04 64-bit server in region `us-west-1`):\n\n    ec2-run-instances ami-87712ac2 --region us-west-1 --instance-type t1.micro --key ec2-us-west-1-keypair --user-data-file bootstrap.sh\n\nNote that `--user-data-file boostrap.sh` is important as it will install Chef-solo and Librarian and you may want to add `-g \u003cyour security group\u003e`.\n\nFind its IP address with:\n\n    ec2-describe-instances --region us-west-1\n\nAfter the machine boots up, provision it using the same recipes as the demo Vagrant machine machine:\n\n    ./setup.sh \u003cip address\u003e path_to_vagrantfile/ ~/.ec2/ec2-us-west-1-keypair\n\nThis will `scp` secure copy Cheffile and dna.json to the EC2 instance, run `librarian-chef install` to fetch the recipes and run `chef-solo`.\n\nIt should print a lot of diagnostic info to the terminal. If it doesn't, wait a little while and try again.\n\nYou can ssh into the machine:\n\n    ssh -i ~/.ec2/ec2-us-west-1-keypair ubuntu@\u003cip address\u003e\n\nThis will terminate your instances when you're finished:\n\n    ec2-terminate-instances --region us-west-1 \u003ci-instance_id\u003e\n\n\n### Converting existing Vagrantfiles\n\nJust add six lines in the provisioning section of your `Vagrantfile` so it looks like this:\n\n    config.vm.provision :chef_solo do |chef|\n\n      \u003cyour provisioning here\u003e\n\n      # Generate the dna.json file used to describe the recipes to be executed by chef-solo on ec2\n      require 'json'\n      open('dna.json', 'w') do |f|\n        chef.json[:run_list] = chef.run_list\n        f.write chef.json.to_json\n      end\n    end\n\n\n## Credits\nInspired by [vagrant-ec2-r](https://github.com/wch/vagrant-ec2-r) from Winston Chang.\nWhich is based on [vagrant-ec2](https://github.com/lynaghk/vagrant-ec2/) from Keming labs.\n[Librarian](https://github.com/applicationsonline/librarian) from Jay Feldblum.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnrako%2Flibrarian-ec2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnrako%2Flibrarian-ec2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnrako%2Flibrarian-ec2/lists"}