Hello I'm reading this howto: https://github.com/imoglobe/opsworks-cookbooks/blob/master/user/README.md but it does not mention where to put the data bag in the cookbook with the list of users in json format.. I have done some searching and answers come up for regular chef and not in AWS opsworks chef. can anyone push me to the right direction? im sure this is a easy answer. Thanks

1 Answer 1


If you're just trying to manage login users then OpsWorks has built in support for allowing IAM users to log into instances within a stack.

On to your actual question - data bag support is limited in OpsWorks. Firstly, data bags are not supported at all prior to Chef 11.10.

In Chef 10.10 you can use data bags but data can only be entered via the custom JSON in the stack settings:

You cannot create a data bag by adding it to your cookbook repository. You must use custom JSON.


You create a data bag by using custom JSON to add one or more attributes to the stack configuration and deployment JSON [:opsworks][:data_bags] attribute.

This is untested, but your custom should probably look something like:

  "opsworks": {
    "data_bags": {
      "users": {
          "id": "hsolo",
          "comment": "Han Solo",
          "home": "/opt/hoth/hsolo",
          "ssh_keys": ["123...", "456..."]

You could probably also set the [:opsworks][:data_bags][:users] key at compile time in your Chef recipe using a JSON file from S3 (see Reading and parsing a JSON file to use in a recipe in this blog post) although I haven't tried it.

  • Thank you, you are right I ended up using the AWS opsworks system instead of chef cookbook. regarding databags thanks. we do use the latest version so they are supposed to work. Jan 29, 2015 at 18:07
  • This worked for me. Don't forget the underscore in data_bags!
    – jmreicha
    May 27, 2015 at 21:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .