Welcome to MLink Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
344 views
in Technique[技术] by (71.8m points)

amazon web services - Architecture for AWS configuration application

I am creating an application which should only store some configuration. I am using AWS AppConfig as the configuration store.

I want to be able to update this configuration data through code. So when an event happens, I want to call SQS to create a message which holds the new configuration data to be appended. The SQS should call a lambda. The Lambda should get the latest configuration from AppConfig, append the new configurations, then deploy to AppConfig.

As a result, I want AppConfig to have the old configurations, and the new ones appended.

Is there a simple way to achieve this using only AWS services?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I've not tried any of this or used AppConfig directly but it shouldn't be difficult for you to piece information together from the web.

  1. Create SQS Queue to hold the updates.
  2. Create Lambda to read from the SQS Queue.
  3. Write code for the Lambda which receives the message from the Queue, pulls the AppConfig and updates with the new values. Use one of the many AWS SDK's for your preferred language.

One thing that you should be aware of is that Lambdas can run multiple at a time so assuming your AppConfig looks like this:

{
   "version": 1
}

then two updates get pushed to the SQS Queue at the same time:

{
    "update1": "abc"
}

and

{
    "update1": "xyz"
}

They could be executed at the same time and a race condition may occur where both save but one overwrwites the other.

I don't see the benefit of the SQS Queue here or understand the full use case or reason for using this set up but I think there may be a better way to achieve what you're trying to achieve.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to MLink Developer Q&A Community for programmer and developer-Open, Learning and Share
...