Comments (6)
@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
- is your s3 bucket accesable from the replication region
- 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.
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.
@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.
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.
@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.
@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)
- Add remove hook
- Delete the tables when fail to setup global table relation
- Support for PAY_PER_REQUEST billing mode HOT 3
- Experiencing an error when creating global table and createStack is false HOT 5
- How to specify dynamodb table name? HOT 2
- How can I customize stack name? HOT 1
- Uses version 2017.11.29 ? HOT 1
- Support of KMSMasterKeyId
- Unable to get version: v2 to work with createStack true HOT 1
- Cant find DybanoDB table whith large stacks (100+ items)
- support serverless remove HOT 7
- Failed to create global table with v1
- Using custom role with createStack: true HOT 1
- Failed to create/update the stack in second region with createStack: true and version v2
- Issue when creating Global table for DynamoDB with GlobalSecondaryIndexes property
- support already created backup tables HOT 1
- Failing silently HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from serverless-create-global-dynamodb-table.