🔧 AI Nachrichten Major AI platforms go down in unprecedented simultaneous outage(03.09.2026 um 17:34 Uhr)
🔧 AI Nachrichten ChatGPT, Claude, and Grok Down? Users Report Widespread Outages(03.09.2026 um 19:14 Uhr)
🔧 AI Nachrichten OpenAI Launches GPT-6 Astra, Says We May Have Entered the AGI Era(03.09.2026 um 22:08 Uhr)
🔧 AI Nachrichten Claude Comes to CarPlay as Fifth Major AI Chatbot App(05.09.2026 um 05:31 Uhr)
🔧 AI Nachrichten OpenAI’s GPT-6 Astra Is AGI, Says NVIDIA CEO Jensen Huang(07.09.2026 um 06:31 Uhr)
🔧 AI Nachrichten Blame AI companies for Mac mini and Mac Studio shortage(31.08.2026 um 10:32 Uhr)
🔧 AI Nachrichten Major AI platforms go down in unprecedented simultaneous outage(03.09.2026 um 17:34 Uhr)
🔧 AI Nachrichten ChatGPT, Claude, and Grok Down? Users Report Widespread Outages(03.09.2026 um 19:14 Uhr)
🔧 AI Nachrichten OpenAI Launches GPT-6 Astra, Says We May Have Entered the AGI Era(03.09.2026 um 22:08 Uhr)
🔧 AI Nachrichten Claude Comes to CarPlay as Fifth Major AI Chatbot App(05.09.2026 um 05:31 Uhr)
🔧 AI Nachrichten OpenAI’s GPT-6 Astra Is AGI, Says NVIDIA CEO Jensen Huang(07.09.2026 um 06:31 Uhr)
🔧 AI Nachrichten Blame AI companies for Mac mini and Mac Studio shortage(31.08.2026 um 10:32 Uhr)

🔧 Programmierung 🕛 kürzlich 10 Min Lesezeit
0

Going Serverless with Dart: AWS Lambda for Flutter Devs

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht




Introduction



Welcome to part one of my series "Going Serverless with Dart". The point of this series is to show you how to write and deploy serverless logic (also known as cloud functions) to the most popular cloud providers: AWS and GCP.



Before we start, I want to briefly explain what serverless (computing) actually means. I really like this explanation from from spiked usage like a DDOS attack.



Amazon offers its serverless components through a service called AWS (Amazon Web Services). Serverless (aka cloud) functions on AWS are called Lambdas.



They are developed based on a technology called a custom runtime for Dart:



. You will notice one thing, the package has not been updated in the last 3 years (at the time of writing).



Thankfully, there is a . These packages are generated high-level APIs for AWS services.



With the custom runtime and all services accessible via packages, let's get to coding.






Writing your first lambda in Dart



Given all the possibilities with lambdas, I decided to show you how to write a lambda that reacts to a DynamoDB trigger. This is extremely useful for many use cases you might want to cover, especially if you are using AWS Amplify with Flutter, as it comes with DynamoDB by default.




ℹ️ You can find the full code on package by Agilord. We can create the client using the credentials available from RuntimeContext. To make this easier to reuse, we can create an extension.




CODE
extension ContextExtensions on RuntimeContext {
DynamoDB get dynamoDb => DynamoDB(
region: region,
credentials: AwsClientCredentials(
accessKey: accessKey,
secretKey: secretAccessKey,
sessionToken: sessionToken,
),
);
}






Lastly, we must register the function handler using the invokeAwsLambdaRuntime method.




CODE
Future<void> main(List<String> args) async {
await invokeAwsLambdaRuntime([handleTodoCreation]);
}






We can use the AWS Console to test the function, but first, we must deploy it.






Deployment



There are many ways to deploy an AWS Lambda, but the two main ones are uploading a .zip file or Docker image or using Infrastructure-as-Code solutions like Serverless Framework, AWS CDK, or Terraform.



I'll show you how to deploy using a .zip file uploaded through the AWS Console since it also teaches you a little bit about which permissions you need to grant.




ℹ️ If you are curious about IaC deployment, I would recommend using AWS CDK. to avoid your data being compromised or leaving your endpoint vulnerable to attacks like DDOS. Common techniques include securing the Lambda with .



I've prepared a runnable which instructs docker how to build an image for AWS.



After running the script, you should have an output folder with boostrap and function.zip files inside. This function.zip is what you will upload to AWS.






Create a lambda and upload .zip




  1. Go to Lambda Console:




CODE
* Open AWS Console

* Search for "*Lambda*"

* Click "*Create function*"





  1. Configure basic settings:




CODE
* Select "*Author from scratch*"

* Use the function name you specified in the handler (`on-create-todo` in the example)

* For Runtime, select "*Amazon Linux 2*"

* Architecture: select *x86\_64* or *arm64*, mine was arm64

* Click "*Create function*"





  1. Upload your zip:




CODE
* In the Code tab of your function

* Click "*Upload from*" dropdown

* Select "*.zip file*"

* Upload your Dart zip file

* Click "*Save*"





  1. Configure the handler:




CODE
* In the Runtime settings section

* Click "*Edit*"

* Set handler to `on-create-todo`

* Click "*Save*"






Create a Dynamo DB trigger



In the Configuration tab, click "Add Trigger".



Then:




  1. Select "DynamoDB" as the trigger source


  2. Find the todos table and click the long link


  3. Make sure "Activate Trigger" is checked ☑️






Configure Environment Variables



In the Configuration tab, find the "Environment variables" sub-tab and click "Edit".




  1. Click "Add environment variable"


  2. The key should be: AWS_EXECUTION_ENV


  3. The value should be: AWS_Lambda_provided.al2


  4. Click "Save"




This is needed for the RuntimeContext of the lambda.





Grant permissions



Lastly, we want to grant permissions.




  1. Click on the Configuration tab of your Lambda


  2. Click on "Permissions"


  3. Click on the role name listed under "Execution role"


  4. Add the required policy:




CODE
* In the IAM role page, click "*Add permissions*" → "*Create inline policy*"

* Choose **JSON** and paste this policy:







CODE
    ```json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"dynamodb:GetRecords",
"dynamodb:GetShardIterator",
"dynamodb:DescribeStream",
"dynamodb:ListStreams",
"dynamodb:UpdateItem"
],
"Resource": [
"arn:aws:dynamodb:<region>:<account-id>:table/todos/stream/*",
"arn:aws:dynamodb:<region>:<account-id>:table/todos"
]
}
]
}
```







CODE
    You can find the region and the account id in the Lambda function ARN:

![How to find the region and account id for granting permissions for DynamoDB](https://cdn.hashnode.com/res/hashnode/image/upload/v1730719831761/cb2b6b43-9678-4d1a-9e9f-79a1100e1fd9.png)





  1. Click "Next"


  2. Give it a name (e.g., TodosStreamReadAccess)


  3. Click "Create policy"







Testing the lambda



Firstly, you can test the lambda using the "Test" tab of of your Lambda and by providing the JSON specified at the beginning.



If something crashes or doesn't work, the AWS console error logs should be helpful. In case they are not, modify the lambda to output more errors and redeploy until you can solve the problem.



The real test is done by going the the DynamoDB.




  1. Click "View all tables"


  2. Click on the todos table


  3. Click "Explore table items"


  4. Click "Create item"



  5. Create an item similar to this:



     or LinkedIn.

    Vollständiger Original-Bericht
    Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
    ↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
3 Quellen
GPT-6 Astra Release Today? OpenAI’s Next Major AI Model Is Almost Here
1 Quelle
Apple accuses OpenAI of destroying evidence as trade-secrets fight intensifies
1 Quelle
Major AI platforms go down in unprecedented simultaneous outage
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Going Serverless with Dart: AWS Lambda for Flutter Devs

Thematisch verwandte Begriffe: Going, Serverless, with, Dart · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...