What you will learn in this TP
- Design a DynamoDB table
- Deploy a Lambda function
- Expose a function through API Gateway
Introduction #
What you will learn in this section
- Design a DynamoDB table
- Deploy a Lambda function
- Expose a function through API Gateway
Context. An internal service must store and read orders. You build a serverless API that costs nothing when idle.
Prerequisites: Docker, the AWS CLI and LocalStack (pip install localstack awscli-local terraform-local): everything runs locally, with no AWS account or charges · Estimated time: 60 min
Hands-on #
Guided steps, with their solution.
1. Create the table
Why? The partition key spreads data; here an order is read by its identifier.
Create thecommandestable (keyid, on-demand billing).2. Write and deploy the function
Why? The function reads the HTTP method from the API Gateway event and acts on the table.
Writeapp.py(POST creates an order, GET reads it), zip it and create the function.3. Expose through an HTTP API
Why? API Gateway routes HTTP requests to the function.
Create an HTTP API withPOST /commandesandGET /commandes/{id}routes integrated with the function.4. Test and observe
Why? Function logs reach CloudWatch Logs, just as on AWS.
Create an order, read it back, request an unknown id and check the logs.
Difficulty level : ●●●○○ (3/5)
My progress
Sign in to track your progress and take notes. Sign in
Recommended Articles
Le calcul sur AWS : EC2, Auto Scaling, Lambda et conteneurs
Choisir et utiliser les services de calcul AWS : instances EC2 (types, AMI, EBS, user data, modèl...
Les bases de données sur AWS : RDS, Aurora, DynamoDB et ElastiCache
Choisir une base de données managée sur AWS : RDS et Aurora pour le relationnel (multi-AZ, réplic...
Informatique serverless : définition, FaaS et cas d'usage
L'informatique serverless expliquée : Function as a Service (FaaS), fonctionnement, avantages, li...
Le réseau AWS : VPC, sous-réseaux, routage et sécurité
Concevoir un réseau AWS : VPC et plages CIDR, sous-réseaux publics et privés, tables de routage, ...
Kubernetes : exposer ses applications (Services, Ingress et Gateway API)
Exposer des applications dans Kubernetes : Services ClusterIP/NodePort/LoadBalancer, Ingress, Ing...
Comprendre AWS : infrastructure mondiale, comptes, outils et tarification
Les bases indispensables pour démarrer sur Amazon Web Services : régions, zones de disponibilité ...
Le stockage sur AWS : S3, EBS, EFS et sauvegarde
Stocker des données sur AWS : Amazon S3 (buckets, classes de stockage, versionnage, cycle de vie,...
Infrastructure as Code sur AWS : CloudFormation, CDK, Terraform et Well-Architected
Décrire et déployer son infrastructure AWS en code avec CloudFormation, le CDK ou Terraform, auto...
Terraform sur plusieurs clouds : AWS, Azure, Google Cloud, OVHcloud et Kubernetes
Utiliser Terraform avec les principaux fournisseurs : aws, azurerm, google, ovh et openstack, kub...