Coder Social home page Coder Social logo

aws-samples / aws-dynamodb-examples Goto Github PK

View Code? Open in Web Editor NEW
530.0 47.0 209.0 755 KB

DynamoDB Examples

License: Apache License 2.0

C# 6.34% Go 7.96% JavaScript 31.55% Python 17.97% Java 24.08% Rust 3.99% Shell 0.27% CSS 4.50% HTML 3.21% Dockerfile 0.14%

aws-dynamodb-examples's Introduction

Various Examples and AWS SDK code examples for Amazon DynamoDB

An Amazon Web Services and DynamoDB community-led repository containing code and examples for developing with and using Amazon DynamoDB.

We have IAM policies for DynamoDB, a script to load an existing table into NoSQL Workbench, CloudFormation examples, and a CDK to track table size and item count histories to CloudWatch.

We also have AWS SDK code examples for DynamoDB in various languages. You can find each language examples here:

PS. If you are up for contributing, we welcome community pull requests.

All code in this repository is provided as is, where is. There are no guarantees, either expressed or implied. It is up to you to check what they do and utilize the code responsibly.

Special thanks to other contributors to this repo before it was moved over to this current location. Here are their GitHub users:

  • @jprivillaso
  • @tywalch
  • @normj
  • @jasonwadsworth
  • @johanrin
  • @DejanBelic
  • @TLaue

aws-dynamodb-examples's People

Contributors

12manoz avatar apivovarov avatar blmille1 avatar brendandixon avatar campbga-aws avatar ctindel avatar dependabot[bot] avatar dymaws avatar gkrumm avatar hayrichu avatar leeroyhannigan avatar loictalbot avatar mikeweltejr avatar mittalgv avatar mslshao avatar nosqlknowhow avatar robm26 avatar rohan-mehta-scf-request avatar rusticpenguin avatar schwar avatar tastefulelk avatar tebanieo avatar zachjonesnoel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aws-dynamodb-examples's Issues

Where is assembly file mentioned in pom.xml?

Am trying to figure out an issue with including dynamodb local with maven-assembly plugin

Failed to create assembly: Error adding file-set for 'com.almworks.sqlite4java:libsqlite4java-linux-i386:so:1.0.392' to archive: Error adding archived file-set. PlexusIoResourceCollection not found

Am trying to understand the changes in the below assembly file to solve the problem.
src/assembly/component.xml

Not able to find this in the repo.

Status code 500 error for running over HTTP

Exception in thread "main" com.amazonaws.AmazonServiceException: The request processing has failed because of an unknown error, exception or failure. (Service: AmazonDynamoDBv2; Status Code: 500; Error Code: InternalFailure; Request ID: 173ec819-fe6c-4113-9cc6-0cdf1afb8cf7)
at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:1182)
at com.amazonaws.http.AmazonHttpClient.executeOneRequest(AmazonHttpClient.java:770)
at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:489)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:310)
at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.invoke(AmazonDynamoDBClient.java:1776)
at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.listTables(AmazonDynamoDBClient.java:1203)
at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.listTables(AmazonDynamoDBClient.java:1216)
at com.amazonaws.services.dynamodbv2.DynamoDBLocalFixture1.main(DynamoDBLocalFixture1.java:60)

NullPointerException running DynamoDBLocalFixture

I'm running it inside Eclipse having successfully done mvn compile and mvn eclipse:eclipse.

Exception in thread "main" java.lang.NullPointerException
at com.amazonaws.services.dynamodbv2.local.shared.access.sqlite.SQLiteDBAccess.initializeMetadataTables(SQLiteDBAccess.java:388)
at com.amazonaws.services.dynamodbv2.local.shared.access.sqlite.SQLiteDBAccess.(SQLiteDBAccess.java:224)
at com.amazonaws.services.dynamodbv2.local.shared.access.sqlite.SQLiteDBAccess.(SQLiteDBAccess.java:193)
at com.amazonaws.services.dynamodbv2.local.embedded.DynamoDBEmbedded.create(DynamoDBEmbedded.java:40)
at com.amazonaws.services.dynamodbv2.local.embedded.DynamoDBEmbedded.create(DynamoDBEmbedded.java:30)
at com.amazonaws.services.dynamodbv2.DynamoDBLocalFixture.main(DynamoDBLocalFixture.java:33)

No versions available for com.amazonaws:DynamoDBLocal:jar:[1.11.86,2.0)

Cloned the repository and ran mvn test but the build failed with the following error:

[ERROR] Failed to execute goal on project aws-dynamodb-examples: Could not resolve dependencies for project com.amazonaws:aws-dynamodb-examples:jar:1.0.0: Failed to collect dependencies at com.amazonaws:DynamoDBLocal:jar:[1.11.86,2.0): No versions available for com.amazonaws:DynamoDBLocal:jar:[1.11.86,2.0) within specified range -> [Help 1]

Example of updating a list object on an item using Node.js

Need an example of performing an update operation on an existing item. Specifically updating a list type attribute in a map item type and doing this in node.js. This code example should live in ./DynamoDB-SDK-Examples/node.js/WorkingWithItems/ directory.

mvn clean package failed

when executing "mvn clean package", comes an error:

[ERROR] Failed to execute goal on project aws-dynamodb-examples: Could not resolve dependencies for project com.amazonaws:aws-dynamodb-examples:jar:1.0.0: Failed to collect dependencies at com.amazonaws:DynamoDBLocal:jar:[1.11.86,2.0): No versions available for com.amazonaws:DynamoDBLocal:jar:[1.11.86,2.0) within specified range -> [Help 1]

DynamoDbLocal using very outdated Jetty

I apologize for filing this issue here. It's related to this project, but only tangentially.

DynamoDbLocal is a great tool that allows users to debug their DynamoDB workloads locally without having to use the "real" service. This is especially useful for testing! Using DynamoDbLocal allows developers to use DynamoDB in unit tests. This may sound small, but it means they don't have to maintain a second persistence and querying runtime for testing, be it embedded SQL, mocks, etc.

However, it's difficult to embed for a few reasons:

  1. It uses an extremely outdated Jetty instance, which fights with most modern deployments and makes it difficult to embed. Embedding is an important use case for testing.
  2. The underlying data store DynamoDB has native deps. SQLite is a marvel, to be sure, but there are other pure-Java alternatives like Derby that should be an adequate (and easier to use) replacement.

Also, given that most everything from AWS is OSS, I'm also surprised that DynamoDbLocal is closed source. It would be enormously beneficial for everything if DynamoDbLocal were OSSed -- AWS would get free pull requests, and developers would have transparency to understand how to use this amazing tool better.

Thank you for your attention and help!

403: Could not resolve com.amazonaws:DynamoDBLocal:1.+.

My project won't download DynamoDBLocal due to a 403.

Could not resolve com.amazonaws:DynamoDBLocal:1.+.
> Failed to list versions for com.amazonaws:DynamoDBLocal.
> Unable to load Maven meta-data from https://s3-us-west-2.amazonaws.com/dynamodb-local/release/com/amazonaws/DynamoDBLocal/maven-metadata.xml.
> Could not GET 'https://s3-us-west-2.amazonaws.com/dynamodb-local/release/com/amazonaws/DynamoDBLocal/maven-metadata.xml'. Received status code 403 from server: Forbidden

I've tried my local S3 URL as well and 403 https://s3.eu-central-1.amazonaws.com/dynamodb-local-frankfurt/release

why the document is not fine

i use dynamodb ,but i cant not find the demo and useage anywhere!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

"Unable to load AWS credentials from any provider in the chain"

I have my application running on EC2. Trying to access dynamoDB from my Java application. But for every operation, I get "Unable to load AWS credentials from any provider in the chain".

  • I have added dynamoDB permissions in the IAM role that gets attached to EC2 instance
  • And also configured EC2 to assume that role in trust relationship.

Code:

try {
            AWSCredentialsProvider provider = new DefaultAWSCredentialsProviderChain();
            AWSCredentials credentials = provider.getCredentials();
            if(credentials != null) {
                LOG.info("Credentials Key: " + credentials.getAWSAccessKeyId());
                LOG.info("Credentials secret: " + credentials.getAWSSecretKey());
            }
        } catch (Exception e) {
            LOG.info("Exception in credentials cause:" + e.getCause() +";message: " + e.getMessage() +";stack: " +e.getStackTrace());
        }

The getCredentials() line itself throws an Exception with message: "Unable to load AWS credentials from any provider in the chain".
If I do not try to get credentials here and pass it to the DynamoDB client:

dynamoDBClient = builder.withEndpointConfiguration(new 
                AwsClientBuilder.EndpointConfiguration(url, region.getName()))
                .withCredentials(credentialProvider())
                .withClientConfiguration(clientConfig)
                .build();

Then it throws the same exception when I try to do any operation.

I tried setting up the proxy too:

ClientConfiguration clientConfig = new ClientConfiguration();
        clientConfig.setProxyHost("yyy");
        clientConfig.setProxyPort(port);
        clientConfig.setNonProxyHosts("xxx");
        clientConfig.setProtocol(Protocol.HTTP);

and then passing it while creating the client:

dynamoDBClient = builder.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(url, region.getName()))
                .withCredentials(credentialProvider())
                .withClientConfiguration(clientConfig)
                .build();

But no success.

Can someone @here guide me what am I missing here?

data generation in dynamodb for test python

User can use example to create test data generation for test. no prior language of python required to generate data if table exists or table can be created using console or api calls in example.

DynamoDB Local Repository broken [HTTP Response 404]

Trying to use the maven repository for dynamodb local artifacts. The hosted repository (http://dynamodb-local.s3-website-us-west-2.amazonaws.com/release) is returning HTTP 404 errors.

Getting build errors from gradle.

Could not resolve all dependencies for configuration ':testCompile'.
Could not find any matches for com.amazonaws:DynamoDBLocal:1.+ as no versions of com.amazonaws:DynamoDBLocal are available.
     Searched in the following locations:
         https://jcenter.bintray.com/com/amazonaws/DynamoDBLocal/maven-metadata.xml
         https://jcenter.bintray.com/com/amazonaws/DynamoDBLocal/
         https://repo1.maven.org/maven2/com/amazonaws/DynamoDBLocal/maven-metadata.xml
         https://repo1.maven.org/maven2/com/amazonaws/DynamoDBLocal/
         http://dynamodb-local.s3-website-us-west-2.amazonaws.com/release/com/amazonaws/DynamoDBLocal/maven-metadata.xml
         http://dynamodb-local.s3-website-us-west-2.amazonaws.com/release/com/amazonaws/DynamoDBLocal/

batchGet method not working

Hi Team,
I have trying to get batch of record. But I'm unable to fetch the record and getting the below error and code.
Please help on that issue.

My Below code
import AWS, { DynamoDB } from 'aws-sdk';
const docClient = new AWS.DynamoDB.DocumentClient();

    const keyMap = await custIDs.map((element: any) => {
        return { customerId: element.mergeCustId.toString(), vehicleId: element.mergeCustId.toString() };
    });
    console.log("keyMap", JSON.stringify(keyMap));
    const params = {
        RequestItems: {
            'eos-dev-Customer-Vehicles': {
                Key: keyMap,
            }
        }
    };
    console.log("params", JSON.stringify(params));
    return docClient.batchGet(keyMap, (err: any, data: any) => {
        if (err) {
            console.log("err", err);
        } else { console.log("data", data); }
    });

Error:

2023-07-11T10:39:32.993Z a89ddd1c-c372-468c-a9d2-a91173ab9a82 INFO err MissingRequiredParameter: Missing required key 'RequestItems' in params
at ParamValidator.fail (/var/task/output/purge-merge-automation/index.js:22005:37)
at ParamValidator.validateStructure (/var/task/output/purge-merge-automation/index.js:22016:14)
at ParamValidator.validateMember (/var/task/output/purge-merge-automation/index.js:22043:21)
at ParamValidator.validate (/var/task/output/purge-merge-automation/index.js:21989:10)
at Request.VALIDATE_PARAMETERS (/var/task/output/purge-merge-automation/index.js:19767:42)
at Request.callListeners (/var/task/output/purge-merge-automation/index.js:25757:20)
at callNextListener (/var/task/output/purge-merge-automation/index.js:25747:12)
at /var/task/output/purge-merge-automation/index.js:19721:9
at finish (/var/task/output/purge-merge-automation/index.js:14369:7)
at /var/task/output/purge-merge-automation/index.js:14387:9
at EnvironmentCredentials.get (/var/task/output/purge-merge-automation/index.js:14925:7)
at getAsyncCredentials (/var/task/output/purge-merge-automation/index.js:14381:24)
at Config.getCredentials (/var/task/output/purge-merge-automation/index.js:14401:9)
at Request.VALIDATE_CREDENTIALS (/var/task/output/purge-merge-automation/index.js:19716:26)
at Request.callListeners (/var/task/output/purge-merge-automation/index.js:25753:18)
at Request.emit (/var/task/output/purge-merge-automation/index.js:25729:10) {
code: 'MissingRequiredParameter',
time: 2023-07-11T10:39:32.990Z
}

DynamoDBLocalFixture is not exiting

I cloned this repository and ran DynamoDBLocalFixture.java as mentioned in the comments section of the same file.

The program ran upto last line successfully but java is not exiting immediately. As per the logs, there are about 8 idle connections created and it is taking around 5 minutes to close all the connections and exit the java. Is there anyway to exit the code just after completing server.stop() other than using System.exit(0) ?

Dynamodb-local dependency failure again.

This follows the same issue as the pre-February (2017) failures when the repo was changed to HTTPS. Cannot build the examples currently:

Could not resolve dependencies for project com.amazonaws:aws-dynamodb-examples:jar:1.0.0: Failed to collect dependencies at com.amazonaws:DynamoDBLocal:jar:[1.11.89,2.0.0)

Have the current repo setting in my pom:

<repository> <id>dynamodblocal</id> <name>AWS DynamoDB Local Release Repository</name> <url>https://s3-us-west-2.amazonaws.com/dynamodb-local/release</url> </repository>

Rust examples outdated

As the title says - Rust examples are outdated. Specially scan operations, and that is what I need the most. Also, I do not know why AWS have examples on so many places...

Dependency version used in examples is 0.0.4-alpha, and a current DynamoDB version is 1.36.0.

Idea / Question: Write Sharding Example

I wrote up a simple example for Write Sharding based on this doc: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-partition-key-sharding.html

Current "functionality" in the script:

  1. Write items with randomized suffix
  2. Get all items for randomized suffix (1 query per suffix)
  3. Write items with calculated suffix
  4. Get items with a calculated suffix

Questions:

  1. Would this be a good example for the repo?
  2. Currently my script has both writing and reading, should I break it up into multiple parts?
  3. I'm not sure which section it should go under. WorkingWithItems?

DynamoDBLocal and aws-java-sdk-dynamodb dependency version issue?

I am trying to use dynamodb local with latest aws sdk but couldn't find the right version of dynamodb local which can work with the latest aws sdk. I tried 1.11.86, 1.11.119 and other versions for dynamodb local but none is working.

<aws-java-sdk.version>1.11.465</aws-java-sdk.version>
<aws.dynamodblocal.version>1.11.119</aws.dynamodblocal.version>

Can you tell me what's the issue?

Dependency can not be resolved in SBT

Sbt can not resolve latest dependencies

resolvers += Resolver.url("dynamodblocal", url("http://dynamodb-local.s3-website-us-west-2.amazonaws.com/release"))
libraryDependencies +=   "com.amazonaws" % "DynamoDBLocal" % "1.11.0.1" % "test"

---Errors---

::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.amazonaws#DynamoDBLocal;1.11.0: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Unresolved dependencies path:
[warn] com.amazonaws:DynamoDBLocal:1.11.0

Downloading too many files

Trying to run maven package on this example project. It is downloading more than 12,000 files? Is this normal?

Need more robust error handling on Rust examples

The Rust examples do not look to have robust error handling examples. For example, the conditional put looks like it'd say the item was inserted even if the put conditions were not met and therefore errored. This needs to be trapped and handled.

Update repository structure

This repository has been growing over the years with examples from different programing languages and some extra functionality.

I think the README.MD should be updated as it redirects readers to different top level folders that don't follow a structure.

I need your feedback about this folder structre that I am proposing below:

  • infrastructure_as_code: The folder will include all the templates used to deploy DynamoDB to an AWS account
    • cloudformation: One folder per solution that includes a deployable cloudformation template, the project MUST have a README.MD file that explains the need of the template.
    • cdk: One folder per solution that includes a deployable CDK project. The project MUST have a README.MD file that explains why this project is important, the pre-requisites and how to deploy it.
    • security: IAM policies examples in JSON format, optionally you can include CDK and cloudformation examples.
  • workshops: All the workshops created in this repository, one workshop per folder with a brief description, this folder should have a README.MD file explaining this in detail. A workshop is intended to be a self service
  • schema_design: This folder contains all the examples and sample code that promotes schema design libraries. README.MD is needed here.
  • deprecated: Any content that is not longer useful/valid.
  • local_development: This is the folder that will include local development instructions.
  • sdk-examples: This directory will replace the DynamoDB-SDK-Examples.
    • One folder per programing language. The initial README.MD needs re-work to keep up with all the examples that we have in this folder.
    • Ideally all the functionality from one language should be supported on another, please aim for consistency over edge cases, if your example is an edge case, create a table at the bottom explaining why it is an edge case.
    • Categories should be updated, and all the examples need to be something different than the documentation, they should include exception handling, pagination and more "real-life" approach.
    • Inside each language folder I recommend to have top level versions ex: javascript/v3 or javascript/v2, followed by a control_plane, data_plane folder for example:
    • javascript
      • v3
        • data_plane
          • table_operations
            • scan ...
          • stream_operations
            • ...

Code quality:

  • Use the same dataset for all the examples! This could mean either to have the sample dataset under the language folder, for example dataset.json or just use the same values for your examples.
  • Examples must be self contained, if you need to create different files for the same example, your example is too big and it needs re-scope.
  • File names, variables should follow language preffered structure, ex: snakecase vs camelcase.
  • Use README.MD to provide useful explanations for your code, let the code be the code.

Doesn't work

Exception in thread "main" com.amazonaws.SdkClientException: Unable to execute HTTP request: The target server failed to respond
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:972)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:676)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:650)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:633)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$300(AmazonHttpClient.java:601)
at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:583)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:447)
at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.doInvoke(AmazonDynamoDBClient.java:1724)
at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.invoke(AmazonDynamoDBClient.java:1700)
at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.listTables(AmazonDynamoDBClient.java:1213)
at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.listTables(AmazonDynamoDBClient.java:1225)
at com.bookdepository.productfeedgenerator.awsdynamodb.DynamoDBLocalFixture.main(DynamoDBLocalFixture.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: org.apache.http.NoHttpResponseException: The target server failed to respond
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:143)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:167)
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
at com.amazonaws.http.protocol.SdkHttpRequestExecutor.doReceiveResponse(SdkHttpRequestExecutor.java:82)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:271)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
at com.amazonaws.http.apache.client.impl.SdkHttpClient.execute(SdkHttpClient.java:72)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1115)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:964)
... 16 more

Problem with docker-compose

I have an application developed with PHP, Nginx and dynamodb. I have create a simple docker-compose to work in local.

version: '3.7'

services:
  nginx_broadway_demo:
    container_name: nginx_broadway_demo
    image: nginx:latest
    ports:
      - 8080:80
    volumes:
      - ./www:/var/www
      - ./docker/nginx/vhost.conf:/etc/nginx/conf.d/default.conf
      - ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf
    links:
      - php_fpm_broadway_demo

  php_fpm_broadway_demo:
    container_name: php_fpm_broadway_demo
    build:
      context: ./docker/php
    ports:
      - 9000:9000
    volumes:
      - .:/var/www/web

  dynamodb:
    image: amazon/dynamodb-local
    ports:
      - 8000:8000
    expose:
      - 8000

Now I need to add dynamodb URL params to allows PHP to make queries to the database. So, if I make a ping from PHP docker container like this works fine:

ping dynamodb

This doesn't work.

ping http://dynamodb:8000

I need to use http://dynamodb:8000 because AWS needs a URI because I have this error if I use http://dynamodb:8000:

Endpoints must be full URIs and include a scheme and host
So: how can I call a docker container like an URL? I have tried with docker-compose parameters like depends, links, network without success

DynamoDBLocal and aws-java-sdk-dynamodb dependency version issue?

I have DynamoDBLocal and aws-java-sdk-dynamodb in my pom and when I'm trying to package its throwing errors::

I have tried multiple ways..

  1. With the following dependencies

     <dependency>
     	<groupId>com.amazonaws</groupId>
     	<artifactId>DynamoDBLocal</artifactId>
     	<version>[1.11.86,2.0)</version>
     	<scope>test</scope>
             </dependency>
             <dependency> 
                     <groupId>com.amazonaws</groupId>
                     <artifactId>aws-java-sdk-dynamodb</artifactId> 
     	<version>1.11.294</version>
           </dependency>  
    

I'm getting following exceptions while running unit test case execution..

java.lang.NoClassDefFoundError: Could not initialize class com.amazonaws.services.dynamodbv2.local.shared.mapper.DynamoDBObjectMapper
at com.amazonaws.services.dynamodbv2.local.server.AbstractLocalDynamoDBServerHandler.(AbstractLocalDynamoDBServerHandler.java:42)

java.lang.NoClassDefFoundError: com/amazonaws/protocol/StructuredPojo

  1. If I'm commenting aws-java-sdk-dynamodb dependency and removing test scope from DynamoDBLocal dependency
    a. I'm getting compilation error because I'm using com.amazonaws.services.dynamodbv2.document.ItemUtils in one of my class file
    b. If I comment out the part where I'm using ItemUtils, Unit test cases executed perfectly but unable to complete packaging as a shade jar file with the following error..
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 5.303 s
    [INFO] Finished at: 2018-03-16T23:35:55-07:00
    [INFO] Final Memory: 28M/315M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.1.0:shade (default) on project lambda_ssh_keys_handler: Error creating shaded jar: error in opening zip file /Users/nmogulla/.m2/repository/com/almworks/sqlite4java/libsqlite4java-linux-i386/1.0.392/libsqlite4java-linux-i386-1.0.392.so -> [Help 1]
    [ERROR]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.