﻿
{"id":26238,"date":"2023-04-16T10:51:11","date_gmt":"2023-04-16T10:51:11","guid":{"rendered":"https:\/\/www.gencayyildiz.com\/blog\/?p=26238"},"modified":"2023-04-16T10:51:11","modified_gmt":"2023-04-16T10:51:11","slug":"asp-net-core-api-uygulamasini-amazon-escye-deploy-etme-aws-fargate-ile-dockerize-operasyonu","status":"publish","type":"post","link":"https:\/\/www.gencayyildiz.com\/blog\/asp-net-core-api-uygulamasini-amazon-escye-deploy-etme-aws-fargate-ile-dockerize-operasyonu\/","title":{"rendered":"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#8217;ye Deploy Etme &#8211; AWS Fargate \u0130le Dockerize Operasyonu"},"content":{"rendered":"<div id=\"fb-root\"><\/div>\n<p>Merhaba,<\/p>\n<p>Bu i\u00e7eri\u011fimizde, bir Asp.NET Core API uygulamas\u0131n\u0131n <em>Amazon Elastic Container Services(Amazon ECS)<\/em>&#8216;a nas\u0131l deploy edilece\u011fini ve uygulamay\u0131 dockerize etmeyi detayl\u0131ca inceleyecek ve bu s\u00fcre\u00e7te Amazon a\u00e7\u0131s\u0131ndan ihtiya\u00e7 duyulacak olan servisleri ele al\u0131yor olaca\u011f\u0131z. O halde buyurun ba\u015flayal\u0131m&#8230;<\/p>\n<h5>Amazon Elastic Container Services(Amazon ECS) Nedir?<\/h5>\n<p><em>Amazon Elastic Container Services<\/em>, Amazon Web Services(AWS) taraf\u0131ndan sunulan, Docker container&#8217;lar\u0131n\u0131n y\u00f6netilmesi ve \u00e7al\u0131\u015ft\u0131r\u0131lmas\u0131ndan sorumlu olan bir servistir. ECS, kullan\u0131c\u0131lara y\u00fcksek \u00f6l\u00e7eklenebilir ve g\u00fcvenli bir \u015fekilde uygulamalar\u0131 \u00e7al\u0131\u015ft\u0131rma ve y\u00f6netme i\u00e7in gerekli altyap\u0131y\u0131 sa\u011flamaktad\u0131r.<\/p>\n<p>ECS, bir docker container&#8217;\u0131n\u0131 \u00f6zelle\u015ftirilmi\u015f bir bilgisayar sunucusuna yerle\u015ftirir, ayr\u0131ca y\u00fcksek performans ve \u00f6l\u00e7eklenebilirlik sa\u011flamak i\u00e7in otomatik olarak kaynaklar\u0131n y\u00f6netimini \u00fcstlenir. Bu, uygulamalar\u0131n daha h\u0131zl\u0131 ba\u015flat\u0131lmas\u0131n\u0131 ve kullan\u0131c\u0131lar\u0131n ihtiya\u00e7lar\u0131na g\u00f6re esnek bir \u015fekilde \u00f6l\u00e7eklendirilmesini sa\u011flar.<\/p>\n<p>ECS, AWS&#8217;nin di\u011fer hizmetleriyle de entegre olabilir. Misal olarak; Amazon Elastic Load Balancer(ELB) ile birlikte kullan\u0131larak load balancing operasyonu ger\u00e7ekle\u015ftirilebilir yahut Amazon CloudWatch Logs ile birlikte kullan\u0131larak container log&#8217;lar\u0131 takip edilebilir.<\/p>\n<h5>AWS Fargate Nedir?<\/h5>\n<p>AWS Fargate, AWS taraf\u0131ndan sunulan bir container servisidir. <em>Amazon Elastic Container Service(Amazon ECS)<\/em> ve <em>Amazon Elastic Kubernetes Service(Amazon EKS)<\/em> ile entegre edilebilmektedir. Fargate, container&#8217;lar\u0131n \u00e7al\u0131\u015ft\u0131rmas\u0131 i\u00e7in kullan\u0131c\u0131 a\u00e7\u0131s\u0131ndan gerekli olan sunucu y\u00f6netimini tamamen ortadan kald\u0131rmakta ve container&#8217;lar\u0131 do\u011frudan bir sanal \u00f6zel bulut(VPC) i\u00e7erisinde \u00e7al\u0131\u015ft\u0131rmaktad\u0131r.<\/p>\n<p>Fargate, kullan\u0131c\u0131lar\u0131n ECS veya EKS arac\u0131l\u0131\u011f\u0131yla y\u00f6netilen container servislerini kullan\u0131rken, sunucular\u0131 y\u00f6netme yahut \u00f6l\u00e7eklendirme gibi konularda endi\u015felenmelerine gerek duyulmaks\u0131z\u0131n uygulama container&#8217;lar\u0131n\u0131 \u00e7al\u0131\u015ft\u0131rmalar\u0131na olanak sa\u011flamakta ve t\u00fcm bunlar\u0131n yan\u0131nda otomatik bir \u015fekilde \u00f6l\u00e7eklendirme(automatic scaling), load balancing, service discovery ve g\u00fcvenlik(security) gibi pek \u00e7ok \u00f6zellik sunmaktad\u0131r.<\/p>\n<p>Ayr\u0131ca Fargate, kullan\u0131c\u0131lar\u0131n uygulamalar\u0131n\u0131 \u00e7al\u0131\u015ft\u0131rmak i\u00e7in sadece gerekti\u011fi kadar kaynak kullanmalar\u0131na olanak tan\u0131yan bir kaynak y\u00f6netimi modeli sunmakta ve b\u00f6ylece uygulama performans\u0131n\u0131 art\u0131rmak i\u00e7in gereksiz yere kaynaklar\u0131n bo\u015fa harcanmas\u0131 durumunu ortadan kald\u0131rmaktad\u0131r.<\/p>\n<h5>Amazon ECS \u0130le \u0130lgili Bilinmesi Gereken Baz\u0131 Terminolojiler<\/h5>\n<table style=\"font-size:12px;\">\n<thead>\n<tr>\n<th width=\"30%\">Task<\/th>\n<th width=\"30%\">Service<\/th>\n<th width=\"30%\">Cluster<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"vertical-align: top;\">Bir veya birden fazla container i\u00e7erebilen uygulama \u00e7al\u0131\u015ft\u0131rma bile\u015fenidir. Task, \u00e7al\u0131\u015ft\u0131raca\u011f\u0131 container&#8217;a dair image, port, protokol vs. gibi bilgileri bar\u0131nd\u0131rmakta ve bu yap\u0131land\u0131rmalar do\u011frultusunda container&#8217;\u0131 aya\u011fa kald\u0131rmaktad\u0131r.<\/td>\n<td style=\"vertical-align: top;\">Birden fazla task instance&#8217;\u0131n\u0131 \u00e7al\u0131\u015ft\u0131rmak i\u00e7in kullan\u0131lan yap\u0131land\u0131rmad\u0131r. Task&#8217;lar\u0131n i\u015flemlerini koordine ederek y\u00fck dengelemesi, y\u00fcksek kullan\u0131labilirlik, \u00f6l\u00e7eklenebilirlik ve performans sa\u011flar. Bir task ba\u015far\u0131s\u0131z oldu\u011fu taktirde di\u011fer task&#8217;lar\u0131n hizmet sa\u011flamaya devam etmesinden, ayr\u0131ca otomatik olarak yeni task&#8217;lar\u0131n olu\u015fturulup \u00f6l\u00e7eklendirilmesinden sorumludur. B\u00f6ylece kaynak y\u00f6netimini olduk\u00e7a kolayla\u015ft\u0131rmaktad\u0131r. Ayr\u0131ca container&#8217;\u0131n s\u00fcr\u00fcm kontrol\u00fc servis sayesinde sa\u011flanmaktad\u0131r.<\/td>\n<td style=\"vertical-align: top;\">Bir grup kaynaklar\u0131n(instance&#8217;lar\u0131n) k\u00fcmesidir. Cluster, container&#8217;lar\u0131n tek bir mant\u0131ksal birimde, y\u00fcksek performansl\u0131 ve \u00f6l\u00e7eklenebilir bir \u015fekilde y\u00f6netilmesine ve koordine edilmesine olanak tan\u0131r.<\/td>\n<\/tr>\n<tr>\n<td colspan=\"3\"><a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu.webp\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu.webp\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"668\" height=\"254\" class=\"aligncenter size-full wp-image-26316\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu.webp 668w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-300x114.webp 300w\" sizes=\"auto, (max-width: 668px) 100vw, 668px\" \/><\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h5>\u0130\u00e7erik Rotam\u0131z Nas\u0131l Olacak?<\/h5>\n<p>Bu i\u00e7er\u011fimizde temelde bir Asp.NET Core API uygulamas\u0131 i\u00e7in olu\u015fturulan docker image&#8217;inin <em>Amazon Elastic Container Registry(ECR)<\/em>&#8216;e y\u00fcklenmesini ve AWS ECS&#8217;de nas\u0131l bar\u0131nd\u0131r\u0131labilece\u011fini ele al\u0131yor olaca\u011f\u0131z. Bu nedenle, \u00f6ncelikle .NET API uygulamas\u0131n\u0131 olu\u015fturacak ve local&#8217;deki MongoDB \u00f6rne\u011fiyle gerekli test i\u015flemlerini ger\u00e7ekle\u015ftirece\u011fiz. Akabinde bu uygulama i\u00e7in bir Dockerfile dosyas\u0131 haz\u0131rlayacak ve olu\u015fturdu\u011fumuz docker image&#8217;ini Amazon ECR&#8217;ye y\u00fckleyece\u011fiz. ECR&#8217;de tan\u0131mlanm\u0131\u015f olan docker image&#8217;ini \u00e7ekmek(pull) ve \u00e7al\u0131\u015ft\u0131rmak(run) i\u00e7in g\u00f6rev tan\u0131mlar\u0131(task definition) olan bir ECS Cluster olu\u015fturaca\u011f\u0131z.<\/p>\n<p>ESC&#8217;nin temel mant\u0131\u011f\u0131, her ECS Cluster&#8217;\u0131n <em>&#8220;n&#8221;<\/em> task definition&#8217;a sahip olaca\u011f\u0131d\u0131r ve buradaki her bir task definition, uygulama deploy yakla\u015f\u0131m\u0131m\u0131za ba\u011fl\u0131 olarak birden fazla docker container&#8217;\u0131 i\u00e7erebilir. Task definition olu\u015fturulduktan sonra bir servis bu g\u00f6rev tan\u0131m\u0131na dayal\u0131 olarak olu\u015fturulabilmektedir. Haliyle biz, bir cluster olu\u015fturacak ve daha sonra biri MongoDB image&#8217;ini di\u011feri de ECR&#8217;den .NET uygulamas\u0131n\u0131 \u00e7eken iki task tan\u0131m\u0131nda bulunacak ve sonras\u0131nda da bu task&#8217;lar\u0131 \u00e7al\u0131\u015ft\u0131racak olan servislerin olu\u015fturulmas\u0131n\u0131 ger\u00e7ekle\u015ftirip, uygulamay\u0131 deploy etmi\u015f olaca\u011f\u0131z.<\/p>\n<p>\u015eimdi gelin t\u00fcm bu s\u00fcreci hep beraber tecr\u00fcbe edelim&#8230;<\/p>\n<h5>\u00d6rnek \u00c7al\u0131\u015fma<\/h5>\n<p>\u015eimdi gelin i\u00e7eri\u011fimizde hedefledi\u011fimiz konular\u0131 ad\u0131m ad\u0131m \u00f6rneklendirmeye ba\u015flayal\u0131m.<\/p>\n<ul>\n<li><em>1. Ad\u0131m <span style=\"font-size:12px;color:green;\">(API Olu\u015fturma ve MongoDB Entegrasyonunu Sa\u011flama)<\/span><\/em><br \/>\n\u00d6rneklendirmeyi ger\u00e7ekle\u015ftirebilmek i\u00e7in bir Asp.NET Core Web API uygulamas\u0131 olu\u015fturunuz ve ard\u0131ndan MongoDB \u00e7al\u0131\u015fmalar\u0131n\u0131 y\u00fcr\u00fctebilmek i\u00e7in <a href=\"https:\/\/www.nuget.org\/packages\/mongodb.driver\/\" rel=\"noopener\" target=\"_blank\">MongoDB.Driver<\/a> k\u00fct\u00fcphanesini kurunuz. Devam\u0131nda ise &#8216;BooksController&#8217; isminde bir controller s\u0131n\u0131f\u0131 olu\u015fturunuz ve a\u015fa\u011f\u0131daki entity e\u015fli\u011finde controller&#8217;\u0131n i\u00e7eri\u011fini tasarlay\u0131n\u0131z.<\/p>\n<div style=\"font-size:12px;\">\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n    public class Book\r\n    {\r\n        &#x5B;BsonId]\r\n        &#x5B;BsonRepresentation(BsonType.ObjectId)]\r\n        public string? Id { get; set; }\r\n        public string? Name { get; set; }\r\n        public string? Author { get; set; }\r\n        public string? PublishedYear { get; set; }\r\n    }\r\n<\/pre>\n<\/div>\n<div style=\"font-size:12px;\">\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n    &#x5B;Route(&quot;api\/&#x5B;controller]&quot;)]\r\n    &#x5B;ApiController]\r\n    public class BooksController : ControllerBase\r\n    {\r\n        readonly IMongoCollection&lt;Book&gt; _bookCollection;\r\n        public BooksController(IConfiguration configuration)\r\n        {\r\n            MongoClient mongoClient = new(configuration&#x5B;&quot;MongoDBConfigurations:ConnectionString&quot;]);\r\n            IMongoDatabase database = mongoClient.GetDatabase(configuration&#x5B;&quot;MongoDBConfigurations:Database&quot;]);\r\n            _bookCollection = database.GetCollection&lt;Book&gt;(configuration&#x5B;&quot;MongoDBConfigurations:BookCollection&quot;]);\r\n        }\r\n\r\n        &#x5B;HttpGet]\r\n        public async Task&lt;IActionResult&gt; Get()\r\n            =&gt; Ok(await _bookCollection.Find(b =&gt; true)\r\n                                    .ToListAsync());\r\n\r\n        &#x5B;HttpPost]\r\n        public async Task&lt;IActionResult&gt; Post(Book book)\r\n        {\r\n            await _bookCollection.InsertOneAsync(book);\r\n            return Ok(book.Id);\r\n        }\r\n    }\r\n<\/pre>\n<\/div>\n<p>Evet, g\u00f6r\u00fcld\u00fc\u011f\u00fc \u00fczere local olarak yap\u0131land\u0131r\u0131lm\u0131\u015f, MongoDB altyap\u0131s\u0131nda, veritaban\u0131na kitap ekleyen ve t\u00fcm kitaplar\u0131 sorgulayarak elde etmemizi sa\u011flayan bir API kurgulanm\u0131\u015f bulunmaktad\u0131r. Tabi burada isterseniz, best practices a\u00e7\u0131s\u0131ndan controller&#8217;da ki business logic&#8217;i farkl\u0131 bir servise al\u0131p oradan y\u00fcr\u00fctmeyi ger\u00e7ekle\u015ftirebilir ve <a href=\"https:\/\/www.gencayyildiz.com\/blog\/asp-net-core-options-pattern\/\" rel=\"noopener\" target=\"_blank\">Options Pattern<\/a>&#8216;\u0131 kullanarak konfig\u00fcrasyonlar\u0131 y\u00fcr\u00fctebilirsiniz. Bizler i\u00e7eri\u011fi \u00e7ok fazla \u015fi\u015firmemek i\u00e7in bu sadelik seviyesinde seyre devam edece\u011fiz.<\/p>\n<p>Ayr\u0131ca konfig\u00fcrasyonel de\u011ferleri &#8216;appsettings.json&#8217; dosyas\u0131nda a\u015fa\u011f\u0131daki gibi tutabilirsiniz:<\/p>\n<div style=\"font-size:12px;\">\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n{\r\n  &quot;Logging&quot;: {\r\n    &quot;LogLevel&quot;: {\r\n      &quot;Default&quot;: &quot;Information&quot;,\r\n      &quot;Microsoft.AspNetCore&quot;: &quot;Warning&quot;\r\n    }\r\n  },\r\n  &quot;AllowedHosts&quot;: &quot;*&quot;,\r\n  &quot;MongoDBConfigurations&quot;: {\r\n    &quot;ConnectionString&quot;: &quot;mongodb:\/\/localhost:27017&quot;,\r\n    &quot;Database&quot;: &quot;AmazonESCDB&quot;,\r\n    &quot;BookCollection&quot;: &quot;Books&quot;\r\n  }\r\n}\r\n<\/pre>\n<\/div>\n<\/li>\n<li><em>2. Ad\u0131m <span style=\"font-size:12px;color:green;\">(Uygulamay\u0131 Dockerize Etme)<\/span><\/em><br \/>\n\u015eimdi olu\u015fturdu\u011fumuz uygulamay\u0131 dockerize edebilmek i\u00e7in \u00f6ncelikle Dockerfile&#8217;\u0131 olu\u015ftural\u0131m. Bunun i\u00e7in uygulaman\u0131n ana dizinine(root) &#8216;Dockerfile&#8217; isminde bir dosya ekleyiniz ve i\u00e7eri\u011fini a\u015fa\u011f\u0131daki gibi doldurunuz.<\/p>\n<div style=\"font-size:12px;\">\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nFROM mcr.microsoft.com\/dotnet\/sdk:7.0 AS build\r\nWORKDIR \/src\r\n\r\nCOPY . .\r\nRUN dotnet restore\r\n\r\nCOPY . .\r\nRUN dotnet publish -c release -o \/app\/publish\r\n\r\nFROM mcr.microsoft.com\/dotnet\/aspnet:7.0\r\nWORKDIR \/app\/publish\r\nCOPY --from=build \/app\/publish .\/\r\n\r\nEXPOSE 80\r\n\r\nENTRYPOINT &#x5B;&quot;dotnet&quot;, &quot;Amazon.ESC.AspNETCore.WebAPI.Deploy.Example.API.dll&quot;]\r\n<\/pre>\n<\/div>\n<p>Ve ard\u0131ndan uygulaman\u0131n ana dizinine odaklanm\u0131\u015f bir powershell ya da cmd a\u00e7arak a\u015fa\u011f\u0131daki talimat e\u015fli\u011finde bu Dockerfile \u00fczerinden bir docker image olu\u015fturunuz.<\/p>\n<div style=\"text-align:center;color:red;font-size:12px;\"><strong>docker build -t amazon-esc-aspnetcore-webapi-deploy-example-api .<\/strong><\/div>\n<p><a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu.png\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"1337\" height=\"679\" class=\"aligncenter size-full wp-image-26251\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu.png 1337w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-300x152.png 300w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-1024x520.png 1024w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-768x390.png 768w\" sizes=\"auto, (max-width: 1337px) 100vw, 1337px\" \/><\/a>Bu talimat neticesinde Dockerfile i\u00e7erisindeki talimatlar\u0131n s\u0131ras\u0131yla i\u015flendi\u011fini ve ilgili image&#8217;\u0131n a\u015fa\u011f\u0131daki ekran g\u00f6r\u00fcnt\u00fcs\u00fcnde oldu\u011fu gibi Docker Desktop \u00fczerinden de g\u00f6zlemlenebildi\u011fi \u015fekliyle ba\u015far\u0131yla olu\u015fturuldu\u011funu g\u00f6r\u00fcyoruz.<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-1.png\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"1235\" height=\"298\" class=\"aligncenter size-full wp-image-26252\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-1.png 1235w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-1-300x72.png 300w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-1-1024x247.png 1024w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-1-768x185.png 768w\" sizes=\"auto, (max-width: 1235px) 100vw, 1235px\" \/><\/a>Art\u0131k olu\u015fturdu\u011fumuz uygulaman\u0131n local&#8217;de image&#8217;\u0131n\u0131 ald\u0131\u011f\u0131m\u0131za g\u00f6re bunu Amazon ECS&#8217;nin de eri\u015febilece\u011fi \u015fekilde internete g\u00f6ndermemiz gerekmektedir. Bunun i\u00e7in ilgili image&#8217;\u0131 Amazon ECR&#8217;ye yani <em>Amazon Elastic Container Registry<\/em>&#8216;e g\u00f6nderiyor olaca\u011f\u0131z.\n<\/li>\n<li><em>3. Ad\u0131m <span style=\"font-size:12px;color:green;\">(Image&#8217;i Amazon ECR&#8217;ye Push&#8217;lama)<\/span><\/em><br \/>\nYukar\u0131daki ad\u0131mda bahsedildi\u011fi gibi taraf\u0131m\u0131zca olu\u015fturulan docker image&#8217;lerine Amazon ECS&#8217;den eri\u015fim g\u00f6sterilebilmesi i\u00e7in g\u00fcvenli bir \u015fekilde depolanmas\u0131n\u0131 ve da\u011f\u0131t\u0131lmas\u0131n\u0131 sa\u011flayan bir havuza g\u00f6ndermemiz gerekmektedir. Bunun i\u00e7in y\u00fcksek performansl\u0131 bar\u0131nd\u0131rma hizmeti sunan Amazon ECR&#8217;yi kullanaca\u011f\u0131z. Tabi sizler isterseniz Amazon ECR&#8217;ye alternatif olarak Docker Hub&#8217;\u0131 da kullanabilirsiniz.<\/p>\n<p>Bunun i\u00e7in \u00f6ncelikle AWS Console \u00fczerinden ECR servisini a\u00e7\u0131n\u0131z ve a\u015fa\u011f\u0131daki gibi bir repository olu\u015fturunuz.<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-2.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-2.png\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"1041\" height=\"256\" class=\"aligncenter size-full wp-image-26249\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-2.png 1041w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-2-300x74.png 300w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-2-1024x252.png 1024w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-2-768x189.png 768w\" sizes=\"auto, (max-width: 1041px) 100vw, 1041px\" \/><\/a><a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-3.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-3.png\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"809\" height=\"633\" class=\"aligncenter size-full wp-image-26250\" \/><\/a>G\u00f6r\u00fcld\u00fc\u011f\u00fc \u00fczere bizler &#8216;amazon-ecs-aspnetcore-webapi-deploy-example&#8217; ad\u0131nda bir repository olu\u015fturmu\u015f bulunuyoruz. Bu i\u015flemin ard\u0131ndan olu\u015fturulan docker image&#8217;\u0131 Amazon ECR&#8217;de olu\u015fturulan bu repository&#8217;e g\u00f6ndermek i\u00e7in Dockerfile&#8217;\u0131n bulundu\u011fu dizini tekrardan powershell yahut cmd ile a\u00e7\u0131n\u0131z ve a\u015fa\u011f\u0131daki talimatlar\u0131 veriniz.<\/p>\n<div style=\"font-size:12px;\">\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\naws ecr get-login-password | docker login --username AWS --password-stdin 567921601443.dkr.ecr.ap-south-1.amazonaws.com\r\ndocker tag amazon-esc-aspnetcore-webapi-deploy-example-api 567921601443.dkr.ecr.ap-south-1.amazonaws.com\/amazon-esc-aspnetcore-webapi-deploy-example\r\ndocker push 567921601443.dkr.ecr.ap-south-1.amazonaws.com\/amazon-esc-aspnetcore-webapi-deploy-example\r\n<\/pre>\n<\/div>\n<blockquote style=\"font-size:12px;\"><p><em>E\u011fer ki, login s\u00fcrecinde problem ya\u015f\u0131yorsan\u0131z a\u015fa\u011f\u0131daki talimat\u0131 deneyiniz.<\/p>\n<div style=\"font-size:10px;\">\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">powershell 'docker login --username AWS -p $(aws ecr get-login-password --region &lt;&lt;region&gt;&gt; ) ****.dkr.ecr.&lt;&lt;region&gt;&gt;.amazonaws.com'<\/pre>\n<\/div>\n<p><\/em><\/p><\/blockquote>\n<p><a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-4.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-4.png\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"1781\" height=\"273\" class=\"aligncenter size-full wp-image-26253\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-4.png 1781w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-4-300x46.png 300w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-4-1024x157.png 1024w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-4-768x118.png 768w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-4-1536x235.png 1536w\" sizes=\"auto, (max-width: 1781px) 100vw, 1781px\" \/><\/a>Bu i\u015flem neticesinde AWS Console&#8217;dan ECR servisine gidip g\u00f6nderilen image&#8217;i a\u015fa\u011f\u0131daki gibi do\u011frulaman\u0131zda fayda vard\u0131r.<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-5.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-5.png\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"648\" height=\"305\" class=\"aligncenter size-full wp-image-26254\" \/><\/a>\n<\/li>\n<li><em>4. Ad\u0131m <span style=\"font-size:12px;color:green;\">(Docker Image&#8217;i Local&#8217;de Test Etme)<\/span><\/em><br \/>\n\u015eimdi uygulamam\u0131z\u0131n image&#8217;ini AWS ECR&#8217;ye g\u00f6nderdi\u011fimize g\u00f6re, ufaktan local&#8217;de bir test ger\u00e7ekle\u015ftirmekte fayda vard\u0131r. Bunun i\u00e7in a\u015fa\u011f\u0131daki docker talimat\u0131n\u0131 vermeniz yeterli olacakt\u0131r;<\/p>\n<div style=\"font-size:12px;\">\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\naws ecr get-login-password | docker login --username AWS --password-stdin 567921601443.dkr.ecr.ap-south-1.amazonaws.com\r\ndocker run -p 8080:80 -e MongoDBConfigurations:ConnectionString='mongodb:\/\/host.docker.internal:27017' -e ASPNETCORE_ENVIRONMENT=Development amazon-esc-aspnetcore-webapi-deploy-example-api\r\n<\/pre>\n<\/div>\n<p>Burada ilk olarak yine docker&#8217;da oturum a\u00e7\u0131yor ard\u0131ndan &#8216;8080&#8217; portunda olu\u015fturdu\u011fumuz image&#8217;dan bir container aya\u011fa kald\u0131r\u0131yoruz. Ayr\u0131ca container&#8217;da kullan\u0131lacak olan MongoDB connection string de\u011ferini environment olarak verdi\u011fimize dikkatinizi \u00e7ekerim.<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-6.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-6.png\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"1092\" height=\"256\" class=\"aligncenter size-full wp-image-26260\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-6.png 1092w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-6-300x70.png 300w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-6-1024x240.png 1024w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-6-768x180.png 768w\" sizes=\"auto, (max-width: 1092px) 100vw, 1092px\" \/><\/a>G\u00f6r\u00fcld\u00fc\u011f\u00fc \u00fczere ilgili talimat \u00e7al\u0131\u015ft\u0131r\u0131ld\u0131\u011f\u0131 taktirde uygulama aya\u011fa kalkmakta ve <a href=\"http:\/\/localhost:8080\/api\/books\" rel=\"noopener\" target=\"_blank\">http:\/\/localhost:8080\/api\/books<\/a> adresine yap\u0131lan istek neticesinde a\u015fa\u011f\u0131daki g\u00f6r\u00fcnt\u00fcde oldu\u011fu gibi kay\u0131tl\u0131 kitaplar taraf\u0131m\u0131za d\u00f6nd\u00fcr\u00fclmektedir.<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-7.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-7.png\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"343\" height=\"321\" class=\"aligncenter size-full wp-image-26261\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-7.png 343w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-7-300x281.png 300w\" sizes=\"auto, (max-width: 343px) 100vw, 343px\" \/><\/a>Evet, uygulamam\u0131z\u0131n gayet sa\u011fl\u0131kl\u0131 bir \u015fekilde \u00e7al\u0131\u015ft\u0131\u011f\u0131n\u0131 g\u00f6zlemlemi\u015f olduk. \u015eimdi s\u0131ra uygulamay\u0131 Amazon ECS&#8217;ye deploy etmeye geldi.\n<\/li>\n<li><em>5. Ad\u0131m <span style=\"font-size:12px;color:green;\">(Amazon ECS&#8217;ye Cluster&#8217;\u0131n\u0131n Olu\u015fturulmas\u0131)<\/span><\/em><br \/>\n\u0130lk olarak Amazon ECS&#8217;yi kullanabilmek, MongoDB ve dotnet uygulamalar\u0131n\u0131 \u00e7al\u0131\u015ft\u0131rabilmek i\u00e7in bir ECS Cluster olu\u015fturulmas\u0131 gerekmektedir. Bunun i\u00e7in a\u015fa\u011f\u0131daki g\u00f6rselde oldu\u011fu gibi AWS Console \u00fczerinden ECS servisine aratarak gidiniz.<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-8.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-8.png\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"852\" height=\"256\" class=\"aligncenter size-full wp-image-26262\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-8.png 852w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-8-300x90.png 300w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-8-768x231.png 768w\" sizes=\"auto, (max-width: 852px) 100vw, 852px\" \/><\/a>Ard\u0131ndan a\u015fa\u011f\u0131daki gibi cluster&#8217;\u0131 olu\u015fturunuz.<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-9.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-9.png\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"598\" height=\"320\" class=\"aligncenter size-full wp-image-26263\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-9.png 598w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-9-300x161.png 300w\" sizes=\"auto, (max-width: 598px) 100vw, 598px\" \/><\/a><a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-10.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-10.png\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"731\" height=\"292\" class=\"aligncenter size-full wp-image-26264\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-10.png 731w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-10-300x120.png 300w\" sizes=\"auto, (max-width: 731px) 100vw, 731px\" \/><\/a>G\u00f6r\u00fcld\u00fc\u011f\u00fc \u00fczere &#8216;amazon-esc-aspnetcore-webapi-deploy-example-api-cluster&#8217; isminde bir cluster olu\u015fturulmu\u015ftur.<\/p>\n<p>\u015eimdi bu i\u015flemi yapt\u0131ktan sonra olu\u015fturulan cluster&#8217;a servis ve task(g\u00f6rev) ekleme i\u015flemlerini ger\u00e7ekle\u015ftirmemiz gerekmektedir.\n<\/li>\n<li><em>6. Ad\u0131m <span style=\"font-size:12px;color:green;\">(MongoDB Task&#8217;\u0131 Olu\u015fturma ve AWS ECS Cluster&#8217;\u0131yla \u0130li\u015fkilendirme)<\/span><\/em><br \/>\n<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-12.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-12.png\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"210\" height=\"216\" class=\"alignleft size-full wp-image-26269\" \/><\/a>\u00d6ncelikle cluster&#8217;da biri servis g\u00f6revi g\u00f6recek di\u011feri ise MongoDB&#8217;yi y\u00fcr\u00fctecek task tan\u0131m\u0131nda bulunmam\u0131z gerekmektedir. Bunun i\u00e7in ECS servisinin men\u00fcs\u00fcnden yandaki gibi &#8216;Task definitions&#8217; sayfas\u0131na geliniz ve a\u00e7\u0131lan sayfada &#8216;Create new task definition&#8217; butonuna t\u0131klay\u0131n\u0131z.<\/p>\n<p>\u0130lk olarak a\u015fa\u011f\u0131daki gibi MongoDB task&#8217;\u0131n\u0131 yap\u0131land\u0131ral\u0131m.<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-13.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-13.png\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"1067\" height=\"801\" class=\"aligncenter size-full wp-image-26295\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-13.png 1067w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-13-300x225.png 300w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-13-1024x769.png 1024w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-13-768x577.png 768w\" sizes=\"auto, (max-width: 1067px) 100vw, 1067px\" \/><\/a>Bu yap\u0131land\u0131rmada container ve image ad\u0131yla birlikte ba\u011flant\u0131 noktalar\u0131 \u00f6nem arz etmektedir. Image ad\u0131n\u0131n &#8216;mongo&#8217; olmas\u0131na dikkat ediniz. Bu \u015fekilde yap\u0131land\u0131rma neticesinde ilgili image&#8217;\u0131 Docker Hub&#8217;dan \u00e7ekecektir.<\/p>\n<p>\u015eimdi task tan\u0131mlama s\u00fcrecinin bir sonraki ad\u0131m\u0131nda ise task&#8217;\u0131n boyutunu ve \u00e7al\u0131\u015faca\u011f\u0131 i\u015fletim sistemini belirleyiniz.<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-14.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-14.png\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"1059\" height=\"812\" class=\"aligncenter size-full wp-image-26271\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-14.png 1059w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-14-300x230.png 300w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-14-1024x785.png 1024w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-14-768x589.png 768w\" sizes=\"auto, (max-width: 1059px) 100vw, 1059px\" \/><\/a>G\u00f6r\u00fcld\u00fc\u011f\u00fc \u00fczere bizim \u00e7al\u0131\u015fmam\u0131zda y\u00fcksek trafik s\u00f6z konusu olmayaca\u011f\u0131 i\u00e7in minimum de\u011ferlerde CPU ve RAM de\u011ferlerini se\u00e7mi\u015f bulunuyoruz. Tabi ki de sizler yaz\u0131l\u0131m\u0131n\u0131z\u0131n i\u015flem hacmine g\u00f6re buradaki de\u011ferleri belirlemeniz gerekti\u011finin fark\u0131ndas\u0131n\u0131z.<\/p>\n<p>Velhas\u0131l, bu temel yap\u0131land\u0131rmalar e\u015fli\u011finde MongoDB task&#8217;\u0131n\u0131 olu\u015fturunuz ve &#8216;Task definitions&#8217; sayfas\u0131nda a\u015fa\u011f\u0131daki gibi listelendi\u011fini g\u00f6rerek, olu\u015fturuldu\u011fundan emin olunuz.<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-15.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-15.png\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"399\" height=\"274\" class=\"aligncenter size-full wp-image-26296\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-15.png 399w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-15-300x206.png 300w\" sizes=\"auto, (max-width: 399px) 100vw, 399px\" \/><\/a>Evet, MongoDB task&#8217;\u0131 olu\u015fturuldu\u011funa g\u00f6re art\u0131k cluster ile ili\u015fkilendirebiliriz. Bunun i\u00e7in &#8216;Clusters&#8217; sayfas\u0131ndan ilgili cluster&#8217;a t\u0131klayarak, a\u015fa\u011f\u0131daki ekran g\u00f6r\u00fcnt\u00fcs\u00fcnde oldu\u011fu gibi sayfan\u0131n hemen a\u015fa\u011f\u0131s\u0131ndaki &#8216;Tasks&#8217; sekmesine geliniz ve &#8216;Run new task&#8217; butonuna t\u0131klay\u0131n\u0131z.<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-16.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-16.png\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"831\" height=\"724\" class=\"aligncenter size-full wp-image-26273\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-16.png 831w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-16-300x261.png 300w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-16-768x669.png 768w\" sizes=\"auto, (max-width: 831px) 100vw, 831px\" \/><\/a>A\u00e7\u0131lan sayfada cluster ile a\u015fa\u011f\u0131daki yap\u0131land\u0131rmalar e\u015fli\u011finde ilgili task&#8217;\u0131 ili\u015fkilendiriniz.<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-17.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-17.png\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"540\" height=\"872\" class=\"aligncenter size-full wp-image-26275\" \/><\/a>Bu i\u015flemin ard\u0131ndan cluster \u00fczerinden &#8216;Tasks&#8217; sekmesine tekrar gelirsek e\u011fer olu\u015fturulan task&#8217;\u0131n cluster ile ili\u015fkilendirildi\u011fini ve biraz bekleyince \u00e7al\u0131\u015ft\u0131r\u0131ld\u0131\u011f\u0131n\u0131 g\u00f6zlemleyebiliriz.<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-18.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-18.png\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"963\" height=\"637\" class=\"aligncenter size-full wp-image-26276\" \/><\/a>\n<\/li>\n<li><em>7. Ad\u0131m <span style=\"font-size:12px;color:green;\">(AWS ECS Cluster&#8217;\u0131na MongoDB Servisi Ekleme)<\/span><\/em><br \/>\n\u015eimdi de cluster&#8217;a MongoDB servisi eklememiz gerekmektedir. Bunun i\u00e7in ilgili cluster \u00fczerinden a\u015fa\u011f\u0131daki ekran g\u00f6r\u00fcnt\u00fcs\u00fcnde oldu\u011fu gibi &#8216;Services&#8217; sekmesine geliniz ve &#8216;Create&#8217; butonuna t\u0131klay\u0131n\u0131z.<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-11.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-11.png\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"733\" height=\"582\" class=\"aligncenter size-full wp-image-26265\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-11.png 733w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-11-300x238.png 300w\" sizes=\"auto, (max-width: 733px) 100vw, 733px\" \/><\/a>Devam\u0131nda ise a\u00e7\u0131lan sayfada a\u015fa\u011f\u0131daki yap\u0131land\u0131rmalar e\u015fli\u011finde servisi olu\u015fturunuz.<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-19.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-19.png\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"387\" height=\"980\" class=\"aligncenter size-full wp-image-26279\" \/><\/a>Ayr\u0131ca bu servise bir load balancer ba\u011flayarak endpoint olu\u015fturabilmek i\u00e7in ayn\u0131 sayfada hafif a\u015fa\u011f\u0131da bulunan &#8216;Load balancing&#8217; k\u0131sm\u0131nda da a\u015fa\u011f\u0131daki yap\u0131land\u0131rmalar\u0131 ger\u00e7ekle\u015ftiriniz.<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-27.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-27.png\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"465\" height=\"818\" class=\"aligncenter size-full wp-image-26304\" \/><\/a>Bu i\u015flemden sonra &#8216;Services&#8217; sekmesinde olu\u015fturulan servisi g\u00f6zlemleyerek, emin olunuz.<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-20.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-20.png\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"984\" height=\"665\" class=\"aligncenter size-full wp-image-26280\" \/><\/a>\n<\/li>\n<li><em>8. Ad\u0131m <span style=\"font-size:12px;color:green;\">(27017 Portuna Trafik \u0130zninin Verilmesi)<\/span><\/em><br \/>\n\u015eimdi 27017 portuna trafik izninin verilmesini ger\u00e7ekle\u015ftirelim. Bunun i\u00e7in ilgili cluster i\u00e7erisinde a\u015fa\u011f\u0131daki ekran g\u00f6r\u00fcnt\u00fcs\u00fcnde oldu\u011fu gibi servise t\u0131klay\u0131n\u0131z, a\u00e7\u0131lan sayfada &#8216;Networking&#8217; sekmesi \u00fczerinden &#8216;Security groups&#8217; ba\u011flant\u0131s\u0131na t\u0131klayarak VPC yap\u0131land\u0131rmalar\u0131na geliniz.<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu.gif\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu.gif\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"800\" height=\"411\" class=\"aligncenter size-full wp-image-26281\" \/><\/a>Ard\u0131ndan a\u015fa\u011f\u0131daki &#8216;Inbound rules&#8217; listesinden ilk rule&#8217;u se\u00e7erek sa\u011f taraftaki &#8216;Edit inbound rules&#8217; butonuna t\u0131klay\u0131n\u0131z.<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-21.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-21.png\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"1595\" height=\"174\" class=\"aligncenter size-full wp-image-26284\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-21.png 1595w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-21-300x33.png 300w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-21-1024x112.png 1024w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-21-768x84.png 768w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-21-1536x168.png 1536w\" sizes=\"auto, (max-width: 1595px) 100vw, 1595px\" \/><\/a>Ve a\u00e7\u0131lan sayfada a\u015fa\u011f\u0131daki gibi yap\u0131land\u0131rmay\u0131 ger\u00e7ekle\u015ftiriniz.<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-22.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-22.png\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"1779\" height=\"365\" class=\"aligncenter size-full wp-image-26287\" \/><\/a>\n<\/li>\n<li><em>9. Ad\u0131m <span style=\"font-size:12px;color:green;\">(Uygulamay\u0131 ECS&#8217;ye Deploy Etme)<\/span><\/em><br \/>\nVe son olarak uygulamay\u0131 ECS&#8217;ye deploy edelim. Bunun i\u00e7in ilk olarak MongoDB task&#8217;\u0131n\u0131n IP&#8217;sini almam\u0131z gerekmektedir. Bunu da a\u015fa\u011f\u0131daki ekran g\u00f6r\u00fcnt\u00fcs\u00fcnde oldu\u011fu gibi edinebilirsiniz.<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-1.gif\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-1.gif\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"800\" height=\"411\" class=\"aligncenter size-full wp-image-26292\" \/><\/a>\u015eimdi &#8216;Task definitions&#8217;dan a\u015fa\u011f\u0131daki ekran g\u00f6r\u00fcnt\u00fcs\u00fcndeki gibi uygulama ayarlar\u0131n\u0131 bar\u0131nd\u0131racak olan bir task olu\u015fturunuz.<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-23.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-23.png\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"867\" height=\"828\" class=\"aligncenter size-full wp-image-26293\" \/><\/a><a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-24.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-24.png\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"868\" height=\"771\" class=\"aligncenter size-full wp-image-26289\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-24.png 868w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-24-300x266.png 300w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-24-768x682.png 768w\" sizes=\"auto, (max-width: 868px) 100vw, 868px\" \/><\/a>Burada dikkat ederseniz &#8216;book-manager-task&#8217;\u0131n\u0131n ba\u011flant\u0131 sa\u011flayaca\u011f\u0131 MondoDB&#8217;nin connection string&#8217;i environment olarak verilmekte ve biraz \u00f6nce edindi\u011fimiz IP bu noktada kullan\u0131lmaktad\u0131r. Ayr\u0131ca container image&#8217;\u0131 olarak ECR&#8217;ye g\u00f6ndermi\u015f oldu\u011fumuz repository&#8217;nin kullan\u0131ld\u0131\u011f\u0131na dikkatinizi \u00e7ekerim. Velhas\u0131l kelam, olu\u015fturulan bu task&#8217;\u0131 cluster&#8217;da aya\u011fa kald\u0131r\u0131n\u0131z.<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-25.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-25.png\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"806\" height=\"691\" class=\"aligncenter size-full wp-image-26290\" \/><\/a>Malumunuz az bekledi\u011finiz taktirde task&#8217;\u0131n &#8216;Running&#8217; stat\u00fcs\u00fcne geldi\u011fini g\u00f6receksiniz.<\/p>\n<p>Ayn\u0131 \u015fekilde cluster \u00fczerinden uygulama i\u00e7in a\u015fa\u011f\u0131daki gibi service olu\u015fturunuz.<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-26.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-26.png\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"653\" height=\"1647\" class=\"aligncenter size-full wp-image-26291\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-26.png 653w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-26-119x300.png 119w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-26-406x1024.png 406w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-26-609x1536.png 609w\" sizes=\"auto, (max-width: 653px) 100vw, 653px\" \/><\/a>A\u015fa\u011f\u0131daki gibi load balancer tan\u0131mlamas\u0131n\u0131 da ger\u00e7ekle\u015ftiriniz.<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-28.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-28.png\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"465\" height=\"796\" class=\"aligncenter size-full wp-image-26309\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-28.png 465w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-28-175x300.png 175w\" sizes=\"auto, (max-width: 465px) 100vw, 465px\" \/><\/a>Ve b\u00f6ylece her iki servisimiz de hizmete haz\u0131r&#8230;<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-29.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-29.png\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"910\" height=\"542\" class=\"aligncenter size-full wp-image-26310\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-29.png 910w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-29-300x179.png 300w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-29-768x457.png 768w\" sizes=\"auto, (max-width: 910px) 100vw, 910px\" \/><\/a>\n<\/li>\n<li><em>10. Ad\u0131m <span style=\"font-size:12px;color:green;\">(Test Etme)<\/span><\/em><br \/>\nYukar\u0131daki ad\u0131mlar do\u011fru bir \u015fekilde uyguland\u0131\u011f\u0131 taktirde API&#8217;\u0131n ECS&#8217;ye ba\u015far\u0131l\u0131 bir \u015fekilde deploy edildi\u011fini varsayabiliriz. Tabi ki de bunu do\u011frulayabilmek i\u00e7in son olarak test yapmak en makuludur. Testi ger\u00e7ekle\u015ftirebilmek i\u00e7in ise uygulama servisi \u00fczerinden endpoint&#8217;e eri\u015fmemiz gerekmektedir. Bunun i\u00e7in de a\u015fa\u011f\u0131daki gibi &#8216;Networking&#8217; sekmesinden &#8216;DNS names&#8217; alt\u0131ndaki ba\u011flant\u0131 \u00fczerinden uygulaman\u0131n endpoint&#8217;ine eri\u015febilirsiniz.<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-2.gif\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-2.gif\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"800\" height=\"417\" class=\"aligncenter size-full wp-image-26313\" \/><\/a>Uygulamam\u0131zda swagger aktif oldu\u011fu i\u00e7in yukar\u0131daki g\u00f6rselde oldu\u011fu gibi endpoint sonuna &#8216;\/swagger&#8217; yaz\u0131p request&#8217;te bulundu\u011fumuz taktirde swagger aray\u00fcz\u00fc taraf\u0131ndan kar\u015f\u0131lan\u0131yorsan\u0131z her \u015fey yolundad\u0131r demektedir.<\/p>\n<p>Son olarak API&#8217;\u0131n swagger aray\u00fcz\u00fc sayesinde testini ger\u00e7ekle\u015ftirip veritaban\u0131na ba\u015far\u0131yla eri\u015febildi\u011fini tecr\u00fcbe ettiyseniz art\u0131k makaleyi burada noktayalabilirsiniz \ud83d\ude42<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-30.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-30.png\" alt=\"Asp.NET Core API Uygulamas\u0131n\u0131 Amazon ESC&#039;ye Deploy Etme - AWS Fargate \u0130le Dockerize Operasyonu\" width=\"582\" height=\"567\" class=\"aligncenter size-full wp-image-26314\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-30.png 582w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2023\/04\/Asp.NET-Core-API-Uygulamasini-Amazon-ESCye-Deploy-Etme-AWS-Fargate-Ile-Dockerize-Operasyonu-30-300x292.png 300w\" sizes=\"auto, (max-width: 582px) 100vw, 582px\" \/><\/a>\n<\/li>\n<\/ul>\n<p>Nihai olarak yapt\u0131klar\u0131m\u0131z\u0131 \u00f6zetlememiz gerekirse e\u011fer;<\/p>\n<ol>\n<li>ASP.NET Core API uygulamas\u0131 olu\u015fturarak Docker image&#8217;\u0131n\u0131 olu\u015fturduk.<\/li>\n<li>Olu\u015fturulan Docker image&#8217;\u0131n\u0131 depolamak ve y\u00f6netebilmek i\u00e7in AWS Container Registry(ECR)&#8217;ye y\u00fckledik.<\/li>\n<li>Amazon ECS&#8217;de bu uygulamaya ait container&#8217;lar\u0131 y\u00f6netip, koordine edece\u011fimiz cluster tan\u0131m\u0131nda bulunduk.<\/li>\n<li>Veritaban\u0131(MongoDB) container&#8217;\u0131 i\u00e7in bir task olu\u015fturduk ve cluster&#8217;da aya\u011fa kald\u0131rd\u0131k.<\/li>\n<li>Yine veritaban\u0131(MongoDB) container&#8217;\u0131n\u0131\/task&#8217;\u0131n\u0131 \u00e7al\u0131\u015ft\u0131rabilmek i\u00e7in bir servis olu\u015fturduk ve bu servise IP tan\u0131mlayabilmek i\u00e7in load balancer ekledik.<\/li>\n<li>Olu\u015fturulan MongoDB servisinin 27017 portuna eri\u015fim i\u00e7in trafik izni verdik.<\/li>\n<li>Uygulamay\u0131 Amazon ECS&#8217;ye deploy edebilmek i\u00e7in uygulamaya dair bir container bar\u0131nd\u0131racak task olu\u015fturduk ve bunu da cluster&#8217;da aya\u011fa kald\u0131rd\u0131k. Burada uygulaman\u0131n image&#8217;\u0131n\u0131 2. ad\u0131mda depolad\u0131\u011f\u0131m\u0131z AWS Container Registry&#8217;den \u00e7ektik.<\/li>\n<li>Ve son olarak uygulama task&#8217;\u0131n\u0131 \u00e7al\u0131\u015ft\u0131racak olan servisi olu\u015fturup yine IP tan\u0131mlayabilmek i\u00e7in bu servise de load balancer ekledik.<\/li>\n<\/ol>\n<p>\u0130\u015fte bu kadar&#8230; \ud83d\ude42<\/p>\n<p>\u0130lgilenenlerin faydalanmas\u0131 dile\u011fiyle&#8230;<br \/>\nSonraki yaz\u0131lar\u0131mda g\u00f6r\u00fc\u015fmek \u00fczere&#8230;<br \/>\n\u0130yi \u00e7al\u0131\u015fmalar&#8230;<\/p>\n<p>Kaynaklar;<br \/>\nhttps:\/\/aws.amazon.com\/tr\/ecs\/features\/<br \/>\nhttps:\/\/codewithmukesh.com\/blog\/deploy-aspnet-core-web-api-to-amazon-ecs\/<\/p>\n<p>Not : \u00d6rnek projeyi a\u015fa\u011f\u0131daki github adresinden edinebilirsiniz.<br \/>\n<a href=\"https:\/\/github.com\/gncyyldz\/Amazon.ESC.AspNETCore.WebAPI.Deploy.Example\" rel=\"noopener\" target=\"_blank\">https:\/\/github.com\/gncyyldz\/Amazon.ESC.AspNETCore.WebAPI.Deploy.Example<\/a><\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Merhaba, Bu i\u00e7eri\u011fimizde, bir Asp.NET Core API uygulamas\u0131n\u0131n Amazon Elastic Container Services(Amazon ECS)&#8216;a nas\u0131l deploy edilece\u011fini ve uygulamay\u0131 dockerize etmeyi detayl\u0131ca inceleyecek ve bu s\u00fcre\u00e7te Amazon a\u00e7\u0131s\u0131ndan ihtiya\u00e7 duyulacak olan servisleri ele al\u0131yor olaca\u011f\u0131z.&#46;&#46;&#46;<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":26316,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4778,4730],"tags":[4779,4785,4786,4783,4780,4784,4781,4731,4787,4782],"class_list":["post-26238","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-amazon-ecs","category-aws","tag-amazon-ecs","tag-amazon-eks","tag-amazon-elastic-container-registry","tag-amazon-elastic-container-service","tag-amazon-elastic-container-services","tag-amazon-elastic-kubernetes-service","tag-amazon-elastic-load-balancer","tag-aws","tag-ecr","tag-elb"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/26238","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/comments?post=26238"}],"version-history":[{"count":20,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/26238\/revisions"}],"predecessor-version":[{"id":26317,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/26238\/revisions\/26317"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/media\/26316"}],"wp:attachment":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/media?parent=26238"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/categories?post=26238"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/tags?post=26238"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}