{"id":635,"date":"2022-03-22T03:36:54","date_gmt":"2022-03-22T03:36:54","guid":{"rendered":"https:\/\/192.168.1.3\/wordpress\/?p=635"},"modified":"2025-01-14T08:58:57","modified_gmt":"2025-01-14T08:58:57","slug":"aws-developer-associate-dva-c01-review-material-api-gateway","status":"publish","type":"post","link":"https:\/\/mylinuxsite.com\/wordpress\/?p=635","title":{"rendered":"AWS Developer Associate (DVA-C01) Review Material \u2013 API Gateway"},"content":{"rendered":"\n<!--more continue reading-->\n\n\n\n<h4 class=\"wp-block-heading\"><strong>General<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\"><li>Supports the following protocols:<ul><li>REST<\/li><\/ul><ul><li>HTTP<\/li><\/ul><ul><li>WebSocket<\/li><\/ul><\/li><li><a rel=\"noreferrer noopener\" href=\"https:\/\/docs.aws.amazon.com\/apigateway\/latest\/developerguide\/http-api-vs-rest.html\" target=\"_blank\">Choose between REST APIs and HTTP APIs<\/a><\/li><li>API Types:<ul><li>HTTP<\/li><li>WebSocket<\/li><li>REST<\/li><li>REST (private)<\/li><\/ul><\/li><li>All of the APIs created with Amazon API Gateway expose HTTPS endpoints only (i.e. No HTTP)<\/li><\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>REST<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\" id=\"block-8bf11898-ef98-4c96-9f01-22543dc509bb\"><li><strong>Has<\/strong>:<ul><li>End Points<\/li><li>Resource<\/li><li>Methods<ul><li>Integration Type<ul><li>Lambda (AWS_PROXY)<\/li><li>HTTP (HTTP or HTTP_PROXY)<\/li><li>Mock<\/li><li>VPC Link<\/li><li>AWS Service (AWS) e.g. DynamoDB, KMS, RDS <\/li><\/ul><\/li><li>Proxy Integration<\/li><\/ul><\/li><\/ul><\/li><li><strong>End Points<\/strong>:<ul><li>Edge-optimized\u00a0&#8211; API Gateway API is deployed to the specified region using a CloudFront distribution.<\/li><li>Private API endpoint &#8211; An API endpoint exposed through interface VPC endpoints and allows a client to securely access private API resources inside a VPC. .<\/li><li>Regional API endpoint &#8211; The API hostname <strong>deployed to the specified Region<\/strong> and intended to serve clients, such as EC2 instances, in the same AWS Region.<\/li><\/ul><\/li><li><strong>Resources<\/strong>:<ul><li>You expose addressable resources as a tree of API\u00a0<a href=\"https:\/\/docs.aws.amazon.com\/apigateway\/api-reference\/resource\/resources\/\">Resources<\/a>\u00a0entities, with the root resource (<code>\/<\/code>) at the top of the hierarchy.<\/li><li>The root resource is relative to the API&#8217;s base URL, which consists of the API endpoint and a stage name. <ul><li><code>{api-id}<\/code>.execute-api.<code>{region}<\/code>.amazonaws.com\/{stage name}<\/li><\/ul><\/li><li>In the API Gateway console, this base URI is referred to as the\u00a0<strong>Invoke URI<\/strong>\u00a0and is displayed in the API&#8217;s stage editor after the API is deployed.<\/li><li>Hierarchy:<ul><li>{Resource}\/{Method} or  {Resource}\/{Sub Resource}\/{Method} e.g.<ul><li>\/GET  &#8211; The GET method of root<\/li><li>\/doc\/GET &#8211; The GET method of \/doc<\/li><\/ul><\/li><\/ul><\/li><\/ul><\/li><li><strong>Integration<\/strong>:<ul><li><strong>Types<\/strong>:<ul><li>Lambda<\/li><li>HTTP<\/li><li>Mock<\/li><li>VPC Link<\/li><li>AWS Service<\/li><\/ul><\/li><li><strong>Integration Request<\/strong> <ul><li>Encapsulates an HTTP request received by the backend.\u00a0<\/li><li>Proxy Integration:<ul><li>Only available for Lambda and HTTP<\/li><li>If selected, input and output <strong>cannot<\/strong> be transformed.<\/li><li><strong>Lambda Proxy Integration <\/strong>&#8211; \u00a0API Gateway passes the incoming request from the client as the input to the backend Lambda function.<\/li><li><strong>HTTP Proxy Integration<\/strong> &#8211; passes the incoming request from the client to the HTTP endpoint and passes the outgoing response from the HTTP endpoint to the client.<\/li><\/ul><\/li><\/ul><\/li><li><strong>Timeout<\/strong>: Default is 29000 ms (50ms &#8211; 29 secs)<\/li><li>Can specify execution role<\/li><li><strong>Mapping Template:<\/strong><ul><li>A script expressed in\u00a0<a rel=\"noreferrer noopener\" href=\"https:\/\/velocity.apache.org\/engine\/devel\/vtl-reference.html\" target=\"_blank\">Velocity Template Language (VTL)<\/a>\u00a0and applied to the payload using\u00a0<a rel=\"noreferrer noopener\" href=\"http:\/\/goessner.net\/articles\/JsonPath\/\" target=\"_blank\">JSONPath expressions<\/a>.<\/li><li>Can modify requests, body, or add headers<\/li><li>Can modify response<\/li><li>Use case:  Convert JSON payload to XML payload for a SOAP backend API.<\/li><\/ul><\/li><\/ul><\/li><li><strong>Stages<\/strong>:<ul><li>A named reference to a deployment, which is a snapshot of the API.<\/li><li>Configurations:<ul><li>Cache<\/li><li>Throttling<\/li><li>WAF<\/li><li>Certificate<\/li><li>Logs\/Tracing<\/li><li>Stage Variables<\/li><li>SDK<\/li><li>Export to Swagger or OpenAPI 3<\/li><li><strong>Canary Deployment<\/strong><\/li><\/ul><\/li><\/ul><\/li><li><strong>Stage Variables:<\/strong><ul><li>\u00a0A name-value pairs that you can define as configuration attributes associated with a deployment stage of a <strong>REST API<\/strong>.<\/li><li>Expression: ${<code>stageVariables.&lt;variable_name><\/code>}<\/li><li>Mapping Template: <code>{\u00a0\"name\" : \"$stageVariables.&lt;variable_name>\"}<\/code><\/li><\/ul><\/li><li><strong>Canary Deployment:<\/strong><ul><li><a rel=\"noreferrer noopener\" href=\"https:\/\/martinfowler.com\/bliki\/CanaryRelease.html\" target=\"_blank\">Is<\/a> a software development strategy in which a new version of an API (as well as other software) is deployed for testing purposes, and the base version remains deployed as a production release for normal operations on the same stage.<\/li><li>Is defined by stages<\/li><li>Procedure:<ul><li>Create a Canary at the stage <\/li><li>Deploy the new version to &#8216;Canary&#8217;<\/li><li>When ready, promote the new version<\/li><\/ul><\/li><\/ul><\/li><li><strong>Caching<\/strong>:<ul><li>Defined by stages<\/li><li>Must define cache capacity: Min 0.5 GB to Max 237 GB<\/li><li>Define the TTL; Default to 300 s<\/li><li>A client can invalidate a cache but needs to grant <strong>InvalidateCache<\/strong> <\/li><\/ul><\/li><li><strong>Resource Policy<\/strong>:<ul><li>Control whether a specified principal (typically an IAM user or role) can invoke the API. You can use API Gateway resource policies to allow your API to be securely invoked by:<ul><li>Users from a specified AWS account.<\/li><li>Specified source IP address ranges or CIDR blocks.<\/li><li>Specified virtual private clouds (VPCs) or VPC endpoints (in any account).<\/li><\/ul><\/li><\/ul><\/li><li><strong>Usage Plans:<\/strong><ul><li><strong>To configure a usage plan<\/strong><ol><li>Create one or more APIs, configure the methods to <strong>require an API key<\/strong>, and <strong>deploy the APIs to stages<\/strong>.<\/li><li><strong>Generate or import API keys<\/strong> to distribute to application developers (your customers) who will be using your API.<\/li><li>Create the <strong>usage plan<\/strong> with the <strong>desired throttle and quota limits<\/strong>.<\/li><li><strong>Associate API stages and API keys with the usage plan<\/strong>.<\/li><li>Callers of the API must supply an assigned API key in the\u00a0<code>x-api-key<\/code>\u00a0header in requests to the API.<\/li><\/ol><\/li><\/ul><\/li><li><strong>Authentication and Authorization<\/strong>:<ul><li>IAM using SIGv4 (AuthZ and AuthN)<\/li><li>Resource Policy (AuthZ)<\/li><li>Lambda Authorizer (AuthZ)<\/li><li>Cognito User Pool (AuthN)<\/li><\/ul><\/li><li><strong>Web Sockets<\/strong>:<ul><li>JSON messages are directed to backend integrations based on routes that you configure. (Non-JSON messages are directed to a\u00a0<code>$default<\/code>\u00a0route that you configure.)<\/li><li>Three predefined routes can be used:\u00a0<code>$connect<\/code>,\u00a0<code>$disconnect<\/code>, and\u00a0<code>$default<\/code>. In addition, you can create custom routes.<ul><li><code><strong>$connect<\/strong><\/code>\u00a0route &#8211; when a persistent connection between the client and a WebSocket API is being initiated.<\/li><li><strong><code>$disconnect<\/code>\u00a0<\/strong>route &#8211;  when the client or the server disconnects from the API.<\/li><li>custom route &#8211; after the route selection expression is evaluated against the message if a matching route is found; the match determines which integration is invoked.<\/li><li><strong><code>$default<\/code>\u00a0<\/strong>route &#8211; if the route selection expression cannot be evaluated against the message or if no matching route is found<\/li><\/ul><\/li><\/ul><\/li><\/ul>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[11],"tags":[],"class_list":["post-635","post","type-post","status-publish","format-standard","hentry","category-aws-review-notes"],"_links":{"self":[{"href":"https:\/\/mylinuxsite.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/635","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mylinuxsite.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mylinuxsite.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mylinuxsite.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mylinuxsite.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=635"}],"version-history":[{"count":29,"href":"https:\/\/mylinuxsite.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/635\/revisions"}],"predecessor-version":[{"id":1437,"href":"https:\/\/mylinuxsite.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/635\/revisions\/1437"}],"wp:attachment":[{"href":"https:\/\/mylinuxsite.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=635"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mylinuxsite.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=635"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mylinuxsite.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=635"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}