1

I am in need of an AWS dynamodb as the backend for my project.. I have already completed the below tasks:

  1. established jar for dynamodb local server to start listening
  2. downloaded PHP SDK from AWS
  3. created an iam user from AWS console and copied the credentials.ini file into .aws folder
  4. Executed the php script to connect my local dynamodb and create the table.

After all those tasks have been completed, localhost gives me a message stating the 'table created'. However am not able to find my table in the AWS console. What could be the problem?.

Am I doing it correctly? .. can someone please shed some light on this?

Here's my connection through PHP:

$client = new Aws\Sdk([
//'profile' => 'default',
'region'  => 'us-west-2',
'version' => 'latest',
'endpoint'   => 'http://localhost:8000',
'credentials' => [
    'key'    => '',
    'secret' => '']
]); 

1 Answer 1

1

Firstly, when you are using local host, the table would be created in your local machine (i.e. not in AWS). You have mentioned AWS console, I understood that as you are looking for the table on "AWS Management Console". When you use endpoint as "http://localhost:8000", the API will never interact with actual AWS.

It refers to the local dynamodb instance.

To check the table on local dynamodb instance:-

1) If you have AWS CLI installed on your system, you can check the existence of the table using below command.

aws dynamodb describe-table --table-name yourTableName --endpoint-url http://localhost:8000

2) Otherwise, go to http://localhost:8000/shell/

var docClient = new AWS.DynamoDB({
    region: 'us-east-1',
    endpoint: "http://localhost:8000"
});
var params = {TableName:'yourTableName'};
docClient.describeTable(params, function(err, data) {
    if (err) {
        console.log(err, err.stack);
    } else {
        console.log(data);
        // php.var_dump(data);
    }
});

If table exists:-

It will show the definition of the table

If table doesn't exists:-

You will get the below error message.

"message":"Cannot do operations on a non-existent table"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.