Data bag Creation

I have nothing but troubles with data bags. The docs have an example for
creating an encrypted data bag:

knife data bag from file my_data_bag /path/to/data_bag_item.json -z
–secret-file /path/to/encrypted_data_bag_secret

My version is:

knife data bag from file aws_sg aws_sg/creds.json --secret foobar

Chef is returning:

ERROR: The object you are looking for could not be found
Response: No data bag ‘aws_sg’ could be found. Please create this data bag
before adding items to it.

My file is:
wsip-70-164-152-148:chef-sauce doug$ cat data_bags/aws_sg/creds.json
{
“id”: “creds”,
“aws_access_key_id”: “xxx”,
“aws_secret_access_key”: “yyy”
}

So, what’s wrong with that? I thought that’s what I was TRYING to… ie
create the data bag…

Doug

If the data bag 'aws_sg' does not yet exist, you have to create it first.
The command would be:
knife data bag create aws_sg

Then your command:
knife data bag from file aws_sg aws_sg/creds.json --secret foobar
...should work.

As the name implies, a data bag is a container, while the "creds.json" file
you're trying to upload is an item to be placed in the container. If the
container does not exist, you cannot place an item in it.

On Sun, Nov 16, 2014 at 8:58 PM, Douglas Garstang doug.garstang@gmail.com
wrote:

I have nothing but troubles with data bags. The docs have an example for
creating an encrypted data bag:

knife data bag from file my_data_bag /path/to/data_bag_item.json -z
--secret-file /path/to/encrypted_data_bag_secret

My version is:

knife data bag from file aws_sg aws_sg/creds.json --secret foobar

Chef is returning:

ERROR: The object you are looking for could not be found
Response: No data bag 'aws_sg' could be found. Please create this data bag
before adding items to it.

My file is:
wsip-70-164-152-148:chef-sauce doug$ cat data_bags/aws_sg/creds.json
{
"id": "creds",
"aws_access_key_id": "xxx",
"aws_secret_access_key": "yyy"
}

So, what's wrong with that? I thought that's what I was TRYING to.. ie
create the data bag...

Doug