GithubHelp home page GithubHelp logo

CreateStack as true is deploying to other region(s) without the deployment package uploaded to corresponding region's S3 bucket about serverless-create-global-dynamodb-table HOT 6 CLOSED

rrahul963 avatar rrahul963 commented on May 30, 2024
CreateStack as true is deploying to other region(s) without the deployment package uploaded to corresponding region's S3 bucket

from serverless-create-global-dynamodb-table.

Comments (6)

rrahul963 avatar rrahul963 commented on May 30, 2024

@malli1246 - seems like you are trying to create the dynamodb table and lambda function in the same serverless.yml file.
When you try and setup global table, the plugin deploys the complete stack in the new replication region and in this case since your stack has lambda function definition as well, it tries to deploy that as well.
Based on the error it seems like when cfn is trying to create lambda fn in new region its not able to access/find the deployment pkg.

Can you please check the following

  1. is your s3 bucket accesable from the replication region
  2. the lambda pkg name - does it contain region in the name

Alternatively, if you set createStack to false then plugin will use AWS SDK to create the tables in replication regions and not try and deploy lambda fn there.

from serverless-create-global-dynamodb-table.

mtimbs avatar mtimbs commented on May 30, 2024

I've also run into this issue. I don't think you can use the createStack: true flag because if I understand it correctly CloudFormation expects a seperate s3 deployment bucket for each region and so your stack won't be able to find anything in the second region as this plugin doesn't trigger uploading the artefacts to each region.

createStack: false also won't deploy the stacks but it will create the tables in all the regions. This means you can't really use this plugin on first deploy. Region 1 will deploy, create the table in all the regions and then when region 2 attempts to deploy the CloudFormation stack will error as the table already exists....

I have only been able to get this to work by doing individual region deploys and then pulling in this plugin. It's not the best DX and not really any easier than manually creating a global table.

Let me know if you'd like someone to look at this and I will give it a crack submitting a PR

from serverless-create-global-dynamodb-table.

rrahul963 avatar rrahul963 commented on May 30, 2024

@mtimbs - you are correct, when you do createStack: true, the plugin will take the whole cfn stack and try to deploy it in new region and with createStack: false, plugin will just create the dynamodb tables in new region and setup sync between the 2.

The plugin was built on an idea that app (lambda) stack is always separate from db (or any other infra) stack. This is also a good practice since your infra is not going to change as frequently as your app.

Let me know your thoughts.

from serverless-create-global-dynamodb-table.

mtimbs avatar mtimbs commented on May 30, 2024

when you do createStack: true, the plugin will take the whole cfn stack and try to deploy it in new region

Serverless framework makes assumptions around the naming of your s3 buckets, so unless you specify the bucket for your deployments this plugin will break (first) deploys and will need to be installed/included after the initial deployment. I think this is fine but maybe worth mentioning in the documentation? (Happy to PR that in if you agree)

The plugin was built on an idea that app (lambda) stack is always separate from db (or any other infra) stack. This is also a good practice since your infra is not going to change as frequently as your app.

I think this is a valid position to take, however it would be nice to be explicit about this (again happy to PR this in). Serverless is still very new and a lot of "best practices" are still evolving. In a traditional microservices/SOA architecture it is quite common to have a seperate table per service that is private to that service, so it is also valid to include Dynamo infrastructure with your application code since only 1-2 lambdas within that service might have read/write access to the table.

I feel like there's scope to evolve this plugin to be more generic, or to take the position that it does what it does and just be clear around the limitations and intended use cases.

from serverless-create-global-dynamodb-table.

rrahul963 avatar rrahul963 commented on May 30, 2024

@mtimbs - if you have a solution in mind then please fell free to open a pr.

i would prefer to keep the plugin focused on what the name suggests i.e. just focused on dynamodb replication but i do get your point about keeping infra with the api specially when developing smaller applications.

from serverless-create-global-dynamodb-table.

rrahul963 avatar rrahul963 commented on May 30, 2024

@mtimbs - i am closing this issue now, feel free to open a PR if you want to contribute back.

from serverless-create-global-dynamodb-table.

Related Issues (18)

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.