{"id":154257,"date":"2022-08-24T11:09:17","date_gmt":"2022-08-24T15:09:17","guid":{"rendered":"https:\/\/ibkrcampus.com\/?p=154257"},"modified":"2022-11-21T09:57:37","modified_gmt":"2022-11-21T14:57:37","slug":"dashboard-framework-part-2-running-shiny-in-aws-fargate-with-cdk","status":"publish","type":"post","link":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/dashboard-framework-part-2-running-shiny-in-aws-fargate-with-cdk\/","title":{"rendered":"Dashboard Framework Part 2: Running Shiny in AWS Fargate with CDK"},"content":{"rendered":"\n<p>In the&nbsp;<a href=\"https:\/\/www.quantargo.com\/blog\/2022-03-07-creating-dashboard-framework-with-aws\">previous post<\/a>&nbsp;we outlined the architecture of a dashboard framework to run dashboards based on multiple technologies including Shiny and Flask in production. We will now show how to run a basic Shiny dashboard in AWS Fargate behind an Application Load Balancer in less than 60 lines of CDK code. To define our stack in a reproducible manner we will make use of the Amazon Cloud Development Kit (CDK) with Typescript. Starting from a basic CDK stack we now specify the most important components of our stack:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>The Application Load Balancer (ALB) to route traffic to our dashboards.<\/li><li>The Fargate cluster to run our dashboard tasks in a scalable manner.<\/li><\/ol>\n\n\n\n<p>The deployed stack will finally run an example Shiny dashboard behind an Application Load Balancer. Note that the resulting stack will only run one dashboard without encryption. We\u2019ll implement these features as part of the next post. The resulting CDK code can also be downloaded from Github at&nbsp;<a href=\"https:\/\/github.com\/quantargo\/dashboards\">https:\/\/github.com\/quantargo\/dashboards<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-prerequisites\">Prerequisites<\/h3>\n\n\n\n<p>To run the following code examples make sure to have<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>an&nbsp;<a href=\"https:\/\/aws.amazon.com\/\">AWS Account<\/a><\/li><li>a locally configured AWS account by running e.g.&nbsp;<code>aws configure<\/code>&nbsp;with the&nbsp;<a href=\"https:\/\/aws.amazon.com\/cli\/\">aws CLI<\/a><\/li><li>a local&nbsp;<a href=\"https:\/\/nodejs.org\/en\/download\">Node.js installation<\/a>&nbsp;(version &gt;= 14.15.0)<\/li><li>Typescript:&nbsp;<code>npm -g install typescript<\/code><\/li><li><a href=\"https:\/\/aws.amazon.com\/cdk\">CDK<\/a>&nbsp;(version &gt;= 2.0):&nbsp;<code>npm install -g aws-cdk<\/code><\/li><\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Initialize CDK and Deploy first App<\/h3>\n\n\n\n<p>To initialize a sample project we first create a project folder and within the folder execute&nbsp;<code>cdk init<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&gt; mkdir dashboards\n  cd dashboards\n  cdk init app --language typescript<\/code><\/pre>\n\n\n\n<p>This command creates a new CDK Typescript project and installs all required packages. The following 2 files are relevant for stack development:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code>bin\/dashboards.ts<\/code>: Main file which initializes CDK stack class. You can explicitly set the environment&nbsp;<code>env<\/code>&nbsp;if you use a different account or region for deployment.<\/li><li><code>lib\/dashboards-stack.ts<\/code>: CDK Stack class to which all components of our stack will be added.<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Specify Application Load Balancer (ALB)<\/h3>\n\n\n\n<p>Next, we need to create an Application Load Balancer (ALB) within a new VPC which is responsible for secure connections and routing. We create a new VPC and add an&nbsp;<code>internetFacing<\/code>&nbsp;load balancer to it. This means that the load balancer will be accessible from the public internet and will therefore be placed into a public subnet. Within the&nbsp;<code>lib\/dashboards-stack.ts<\/code>file we put the following lines:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&gt; \/\/ Put imports on top of the file\n  import * as ec2 from 'aws-cdk-lib\/aws-ec2';\n  import * as elbv2 from 'aws-cdk-lib\/aws-elasticloadbalancingv2'\n\n  \/\/ Put below lines within the DashboardsStack constructor\n  const vpc = new ec2.Vpc(this, 'MyVpc');\n\n  const lb = new elbv2.ApplicationLoadBalancer(this, 'LB', {\n    vpc: vpc,\n    internetFacing: true,\n    loadBalancerName: 'DashboardBalancer'\n  });<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Specify Dashboard Cluster<\/h3>\n\n\n\n<p>Next, we need to add an ECS cluster to our VPC to run our dashboards efficiently:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&gt; \/\/ Put imports on top of the file\n  import * as ecs from 'aws-cdk-lib\/aws-ecs'\n\n  \/\/ Put below lines within the DashboardsStack constructor\n  const cluster = new ecs.Cluster(this, 'DashboardCluster', {\n    vpc: vpc\n  });<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Add First Fargate Task Definition<\/h3>\n\n\n\n<p>We can now add our first Fargate dashboard to the cluster by specifying a task definition. We use the&nbsp;<a href=\"https:\/\/hub.docker.com\/r\/rocker\/shiny\">rocker\/shiny<\/a>&nbsp;Docker container as an example running on port&nbsp;<code>3838<\/code>. This also requires respective port mappings in the container definition. Additionally, we use&nbsp;<em>half<\/em>&nbsp;a virtual CPU (<code>512<\/code>)\u2014<code>1024<\/code>would equal a&nbsp;<em>full<\/em>&nbsp;one\u2014and a memory size of 1024 MiB. By specifying the Fargate&nbsp;<code>service<\/code>&nbsp;we are already finished with the specification to run our first container in the cluster:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&gt; const taskDefinition = new ecs.FargateTaskDefinition(this, 'TaskDefinition', {\n   cpu: 512,\n   memoryLimitMiB: 1024,\n  });\n\n  const port = 3838\n\n  const container = taskDefinition.addContainer('Container', {\n    image: ecs.ContainerImage.fromRegistry('rocker\/shiny'),\n    portMappings: &#91;{ containerPort: port }],\n  })\n\n  const service = new ecs.FargateService(this, 'FargateService', {\n    cluster: cluster,\n    taskDefinition: taskDefinition,\n    desiredCount: 1,\n    serviceName: 'FargateService'\n  })<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Put Service Behind ALB<\/h3>\n\n\n\n<p>Next, we put the Fargate service into an ALB target group so that traffic can be routed through the ALB:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&gt; const tg1 = new elbv2.ApplicationTargetGroup(this, 'TargetGroup', {\n   vpc: vpc,\n   targets: &#91;service],\n   protocol: elbv2.ApplicationProtocol.HTTP,\n   stickinessCookieDuration: cdk.Duration.days(1),\n   port: port,\n   healthCheck: {\n     path: '\/',\n     port: `${port}`\n   }\n })<\/code><\/pre>\n\n\n\n<p>Note that we added 2 parameters to the ALB target group definition:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>stickinessCookieDuration<\/strong>: Since Shiny sessions are stateful we need to prevent the ALB to switch instances (in case there are more) during a session. The session duration set to one day should be sufficient.<\/li><li><strong>healthCheck<\/strong>: The health check needs to specify the port (as string) and set to the container port 3838, as well.<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-\"><\/h3>\n\n\n\n<p>Finally, we add an HTTP listener which directly forwards all incoming traffic to our dashboard:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&gt; const listener = lb.addListener(`HTTPListener`, {\n   port: 80,\n   defaultAction: elbv2.ListenerAction.forward(&#91;tg1]) \n })<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Deploy<\/h3>\n\n\n\n<p>Before deployment you should also bootstrap your CDK environment:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&gt; cdk bootstrap<\/code><\/pre>\n\n\n\n<p>Now the stack should be ready for deployment. As an extra step, you can now check if the stack can be successfully synthesized using<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&gt; cdk synth<\/code><\/pre>\n\n\n\n<p>Any errors popping up during&nbsp;<code>cdk synth<\/code>&nbsp;need to be fixed immediately. By continously using&nbsp;<code>cdk synth<\/code>&nbsp;we make sure that the feedback cycles during development are as short as possible. If&nbsp;<code>cdk synth<\/code>&nbsp;is successful we can now run<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&gt; cdk deploy<\/code><\/pre>\n\n\n\n<p>Finally, you should see the successful output message including the&nbsp;<code>DashboardsStack.LoadBalancerDNSName<\/code>&nbsp;which you can directly access through the browser:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&gt; Outputs:\n  DashboardsStack.LoadBalancerDNSName = DashboardBalancer-&lt;9-DIGIT-NUMBER&gt;.&lt;region&gt;.elb.amazonaws.com\n  Stack ARN:\n  arn:aws:cloudformation:&lt;region&gt;:&lt;AWS-ACCOUNT-NO&gt;:stack\/DashboardsStack\/&lt;uuid&gt;\n\n    Total time: 297.67s<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1100\" height=\"774\" data-src=\"\/campus\/wp-content\/uploads\/sites\/2\/2022\/08\/shiny-app-1100x774.png\" alt=\"\" class=\"wp-image-154350 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/08\/shiny-app-1100x774.png 1100w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/08\/shiny-app-700x492.png 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/08\/shiny-app-300x211.png 300w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/08\/shiny-app-768x540.png 768w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/08\/shiny-app-1536x1080.png 1536w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/08\/shiny-app.png 1752w\" data-sizes=\"(max-width: 1100px) 100vw, 1100px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1100px; aspect-ratio: 1100\/774;\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Destroy<\/h3>\n\n\n\n<p>If you don\u2019t use the stack any more and to reduce cloud costs just run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&gt; cdk destroy<\/code><\/pre>\n\n\n\n<p><em>Visit Quantargo for additional insight on this topic: <a href=\"https:\/\/www.quantargo.com\/blog\/2022-03-11-creating-dashboard-framework-with-aws-part2\">https:\/\/www.quantargo.com\/blog\/2022-03-11-creating-dashboard-framework-with-aws-part2<\/a>.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We will now show how to run a basic Shiny dashboard in AWS Fargate behind an Application Load Balancer in less than 60 lines of CDK code. <\/p>\n","protected":false},"author":186,"featured_media":103381,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[339,338,341,351,344],"tags":[12597,12595,12596,12593,852,12598,12594],"contributors-categories":[13759],"class_list":{"0":"post-154257","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-data-science","8":"category-ibkr-quant-news","9":"category-quant-development","10":"category-quant-europe","11":"category-quant-regions","12":"tag-application-load-balancer","13":"tag-aws-fargate","14":"tag-cdk","15":"tag-dashboard-framework","16":"tag-machine-learning","17":"tag-node-js","18":"tag-shiny-server","19":"contributors-categories-quantargo"},"pp_statuses_selecting_workflow":false,"pp_workflow_action":"current","pp_status_selection":"publish","acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.9 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Dashboard Framework Part 2: Running Shiny in AWS Fargate with CDK<\/title>\n<meta name=\"description\" content=\"We will now show how to run a basic Shiny dashboard in AWS Fargate behind an Application Load Balancer in less than 60 lines of CDK code.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.interactivebrokers.com\/campus\/wp-json\/wp\/v2\/posts\/154257\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Dashboard Framework Part 2: Running Shiny in AWS Fargate with CDK | IBKR Quant Blog\" \/>\n<meta property=\"og:description\" content=\"We will now show how to run a basic Shiny dashboard in AWS Fargate behind an Application Load Balancer in less than 60 lines of CDK code.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/dashboard-framework-part-2-running-shiny-in-aws-fargate-with-cdk\/\" \/>\n<meta property=\"og:site_name\" content=\"IBKR Campus US\" \/>\n<meta property=\"article:published_time\" content=\"2022-08-24T15:09:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-11-21T14:57:37+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2021\/09\/machine-learning-2.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"563\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Contributor Author\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Contributor Author\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\n\t    \"@context\": \"https:\\\/\\\/schema.org\",\n\t    \"@graph\": [\n\t        {\n\t            \"@type\": \"NewsArticle\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/dashboard-framework-part-2-running-shiny-in-aws-fargate-with-cdk\\\/#article\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/dashboard-framework-part-2-running-shiny-in-aws-fargate-with-cdk\\\/\"\n\t            },\n\t            \"author\": {\n\t                \"name\": \"Contributor Author\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/e823e46b42ca381080387e794318a485\"\n\t            },\n\t            \"headline\": \"Dashboard Framework Part 2: Running Shiny in AWS Fargate with CDK\",\n\t            \"datePublished\": \"2022-08-24T15:09:17+00:00\",\n\t            \"dateModified\": \"2022-11-21T14:57:37+00:00\",\n\t            \"mainEntityOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/dashboard-framework-part-2-running-shiny-in-aws-fargate-with-cdk\\\/\"\n\t            },\n\t            \"wordCount\": 717,\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/dashboard-framework-part-2-running-shiny-in-aws-fargate-with-cdk\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2021\\\/09\\\/machine-learning-2.jpg\",\n\t            \"keywords\": [\n\t                \"Application Load Balancer\",\n\t                \"AWS Fargate\",\n\t                \"CDK\",\n\t                \"Dashboard Framework\",\n\t                \"Machine Learning\",\n\t                \"Node.js\",\n\t                \"Shiny Server\"\n\t            ],\n\t            \"articleSection\": [\n\t                \"Data Science\",\n\t                \"Quant\",\n\t                \"Quant Development\",\n\t                \"Quant Europe\",\n\t                \"Quant Regions\"\n\t            ],\n\t            \"inLanguage\": \"en-US\"\n\t        },\n\t        {\n\t            \"@type\": \"WebPage\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/dashboard-framework-part-2-running-shiny-in-aws-fargate-with-cdk\\\/\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/dashboard-framework-part-2-running-shiny-in-aws-fargate-with-cdk\\\/\",\n\t            \"name\": \"Dashboard Framework Part 2: Running Shiny in AWS Fargate with CDK | IBKR Quant Blog\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\"\n\t            },\n\t            \"primaryImageOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/dashboard-framework-part-2-running-shiny-in-aws-fargate-with-cdk\\\/#primaryimage\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/dashboard-framework-part-2-running-shiny-in-aws-fargate-with-cdk\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2021\\\/09\\\/machine-learning-2.jpg\",\n\t            \"datePublished\": \"2022-08-24T15:09:17+00:00\",\n\t            \"dateModified\": \"2022-11-21T14:57:37+00:00\",\n\t            \"description\": \"We will now show how to run a basic Shiny dashboard in AWS Fargate behind an Application Load Balancer in less than 60 lines of CDK code.\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"ReadAction\",\n\t                    \"target\": [\n\t                        \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/dashboard-framework-part-2-running-shiny-in-aws-fargate-with-cdk\\\/\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"ImageObject\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/dashboard-framework-part-2-running-shiny-in-aws-fargate-with-cdk\\\/#primaryimage\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2021\\\/09\\\/machine-learning-2.jpg\",\n\t            \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2021\\\/09\\\/machine-learning-2.jpg\",\n\t            \"width\": 1000,\n\t            \"height\": 563,\n\t            \"caption\": \"Machine Learning\"\n\t        },\n\t        {\n\t            \"@type\": \"WebSite\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/\",\n\t            \"name\": \"IBKR Campus US\",\n\t            \"description\": \"Financial Education from Interactive Brokers\",\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"SearchAction\",\n\t                    \"target\": {\n\t                        \"@type\": \"EntryPoint\",\n\t                        \"urlTemplate\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/?s={search_term_string}\"\n\t                    },\n\t                    \"query-input\": {\n\t                        \"@type\": \"PropertyValueSpecification\",\n\t                        \"valueRequired\": true,\n\t                        \"valueName\": \"search_term_string\"\n\t                    }\n\t                }\n\t            ],\n\t            \"inLanguage\": \"en-US\"\n\t        },\n\t        {\n\t            \"@type\": \"Organization\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\",\n\t            \"name\": \"Interactive Brokers\",\n\t            \"alternateName\": \"IBKR\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/\",\n\t            \"logo\": {\n\t                \"@type\": \"ImageObject\",\n\t                \"inLanguage\": \"en-US\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/logo\\\/image\\\/\",\n\t                \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/05\\\/ibkr-campus-logo.jpg\",\n\t                \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/05\\\/ibkr-campus-logo.jpg\",\n\t                \"width\": 669,\n\t                \"height\": 669,\n\t                \"caption\": \"Interactive Brokers\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/logo\\\/image\\\/\"\n\t            },\n\t            \"publishingPrinciples\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/about-ibkr-campus\\\/\",\n\t            \"ethicsPolicy\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/cyber-security-notice\\\/\"\n\t        },\n\t        {\n\t            \"@type\": \"Person\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/e823e46b42ca381080387e794318a485\",\n\t            \"name\": \"Contributor Author\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/author\\\/contributor-author\\\/\"\n\t        }\n\t    ]\n\t}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Dashboard Framework Part 2: Running Shiny in AWS Fargate with CDK","description":"We will now show how to run a basic Shiny dashboard in AWS Fargate behind an Application Load Balancer in less than 60 lines of CDK code.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.interactivebrokers.com\/campus\/wp-json\/wp\/v2\/posts\/154257\/","og_locale":"en_US","og_type":"article","og_title":"Dashboard Framework Part 2: Running Shiny in AWS Fargate with CDK | IBKR Quant Blog","og_description":"We will now show how to run a basic Shiny dashboard in AWS Fargate behind an Application Load Balancer in less than 60 lines of CDK code.","og_url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/dashboard-framework-part-2-running-shiny-in-aws-fargate-with-cdk\/","og_site_name":"IBKR Campus US","article_published_time":"2022-08-24T15:09:17+00:00","article_modified_time":"2022-11-21T14:57:37+00:00","og_image":[{"width":1000,"height":563,"url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2021\/09\/machine-learning-2.jpg","type":"image\/jpeg"}],"author":"Contributor Author","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Contributor Author","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/dashboard-framework-part-2-running-shiny-in-aws-fargate-with-cdk\/#article","isPartOf":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/dashboard-framework-part-2-running-shiny-in-aws-fargate-with-cdk\/"},"author":{"name":"Contributor Author","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/e823e46b42ca381080387e794318a485"},"headline":"Dashboard Framework Part 2: Running Shiny in AWS Fargate with CDK","datePublished":"2022-08-24T15:09:17+00:00","dateModified":"2022-11-21T14:57:37+00:00","mainEntityOfPage":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/dashboard-framework-part-2-running-shiny-in-aws-fargate-with-cdk\/"},"wordCount":717,"publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"image":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/dashboard-framework-part-2-running-shiny-in-aws-fargate-with-cdk\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2021\/09\/machine-learning-2.jpg","keywords":["Application Load Balancer","AWS Fargate","CDK","Dashboard Framework","Machine Learning","Node.js","Shiny Server"],"articleSection":["Data Science","Quant","Quant Development","Quant Europe","Quant Regions"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/dashboard-framework-part-2-running-shiny-in-aws-fargate-with-cdk\/","url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/dashboard-framework-part-2-running-shiny-in-aws-fargate-with-cdk\/","name":"Dashboard Framework Part 2: Running Shiny in AWS Fargate with CDK | IBKR Quant Blog","isPartOf":{"@id":"https:\/\/ibkrcampus.com\/campus\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/dashboard-framework-part-2-running-shiny-in-aws-fargate-with-cdk\/#primaryimage"},"image":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/dashboard-framework-part-2-running-shiny-in-aws-fargate-with-cdk\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2021\/09\/machine-learning-2.jpg","datePublished":"2022-08-24T15:09:17+00:00","dateModified":"2022-11-21T14:57:37+00:00","description":"We will now show how to run a basic Shiny dashboard in AWS Fargate behind an Application Load Balancer in less than 60 lines of CDK code.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/dashboard-framework-part-2-running-shiny-in-aws-fargate-with-cdk\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/dashboard-framework-part-2-running-shiny-in-aws-fargate-with-cdk\/#primaryimage","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2021\/09\/machine-learning-2.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2021\/09\/machine-learning-2.jpg","width":1000,"height":563,"caption":"Machine Learning"},{"@type":"WebSite","@id":"https:\/\/ibkrcampus.com\/campus\/#website","url":"https:\/\/ibkrcampus.com\/campus\/","name":"IBKR Campus US","description":"Financial Education from Interactive Brokers","publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ibkrcampus.com\/campus\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/ibkrcampus.com\/campus\/#organization","name":"Interactive Brokers","alternateName":"IBKR","url":"https:\/\/ibkrcampus.com\/campus\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/logo\/image\/","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/ibkr-campus-logo.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/ibkr-campus-logo.jpg","width":669,"height":669,"caption":"Interactive Brokers"},"image":{"@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/logo\/image\/"},"publishingPrinciples":"https:\/\/www.interactivebrokers.com\/campus\/about-ibkr-campus\/","ethicsPolicy":"https:\/\/www.interactivebrokers.com\/campus\/cyber-security-notice\/"},{"@type":"Person","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/e823e46b42ca381080387e794318a485","name":"Contributor Author","url":"https:\/\/www.interactivebrokers.com\/campus\/author\/contributor-author\/"}]}},"jetpack_featured_media_url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2021\/09\/machine-learning-2.jpg","_links":{"self":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/154257","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/users\/186"}],"replies":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/comments?post=154257"}],"version-history":[{"count":0,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/154257\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media\/103381"}],"wp:attachment":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media?parent=154257"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/categories?post=154257"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/tags?post=154257"},{"taxonomy":"contributors-categories","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/contributors-categories?post=154257"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}