<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Uditha Maduranga</title>
    <description>The latest articles on DEV Community by Uditha Maduranga (@maduranga95).</description>
    <link>https://dev.to/maduranga95</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F452416%2Ffaa557ac-a3f4-444b-a65c-f470da17aca7.jpg</url>
      <title>DEV Community: Uditha Maduranga</title>
      <link>https://dev.to/maduranga95</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/maduranga95"/>
    <language>en</language>
    <item>
      <title>Run a Scheduled Task Using AWS Fargate With CI/CD</title>
      <dc:creator>Uditha Maduranga</dc:creator>
      <pubDate>Sat, 12 Dec 2020 06:14:48 +0000</pubDate>
      <link>https://dev.to/maduranga95/run-a-scheduled-task-using-aws-fargate-with-ci-cd-3pej</link>
      <guid>https://dev.to/maduranga95/run-a-scheduled-task-using-aws-fargate-with-ci-cd-3pej</guid>
      <description>&lt;p&gt;If you ever get the need of running your own script in any language, in a scheduled manner or repetitively with specific instructions, this one is for you.&lt;/p&gt;

&lt;p&gt;In many applications, commonly in data visualization applications, we need some piece of code to be run in fixed times, dates, or intervals. These code chunks can be making API calls, get data from a database, doing some processing, or anything you want.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here, you’ll get to know an easy way to run such a script according to a predefined schedule.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Cron" rel="noopener noreferrer"&gt;Cron jobs&lt;/a&gt; are one of the popular job schedulers that provide a utility for scheduling tasks of any kind in &lt;a href="https://en.wikipedia.org/wiki/Unix-like" rel="noopener noreferrer"&gt;Unix-like&lt;/a&gt; computer &lt;a href="https://en.wikipedia.org/wiki/Operating_system" rel="noopener noreferrer"&gt;operating systems&lt;/a&gt;. An important thing to keep in mind when we are using cron jobs is cron expressions.&lt;/p&gt;

&lt;p&gt;A cron expression is commonly used to let you define when tasks should be run. There are different variants of cron expressions used in systems, like &lt;a href="https://jenkins.io/" rel="noopener noreferrer"&gt;Jenkins&lt;/a&gt;, &lt;a href="https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/" rel="noopener noreferrer"&gt;Kubernetes CronJob&lt;/a&gt;, &lt;a href="https://aws.amazon.com/about-aws/whats-new/2018/08/aws-fargate-now-supports-time-and-event-based-task-scheduling/" rel="noopener noreferrer"&gt;Fargate Scheduled Task&lt;/a&gt;, etc. Make sure you check its instructions before use.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Let’s jump into the topic.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We would all like to schedule recurring tasks as easy and efficiently as possible. In every complex project, this is needed for updating data, ingesting data, or similar use cases.&lt;/p&gt;

&lt;p&gt;With AWS Fargate, it is possible to have orchestrated clusters on which you can run your tasks in Docker containers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Before Starting You’ll Need
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;a href="https://jenkins.io/" rel="noopener noreferrer"&gt;Jenkins&lt;/a&gt; server installed.&lt;/li&gt;
&lt;li&gt;GitHub account with a GitHub Repository.&lt;/li&gt;
&lt;li&gt;If you’re using an Enterprise GitHub account, first you need to generate the private and public keys (&lt;a href="https://www.ssh.com/ssh/keygen/" rel="noopener noreferrer"&gt;ssh-keygen&lt;/a&gt;).
Add credentials to the Jenkins server.&lt;/li&gt;
&lt;li&gt;Configure your GitHub account by adding your public key there.&lt;/li&gt;
&lt;li&gt;Set up Docker on your computer. &lt;a href="https://docs.docker.com/get-started/" rel="noopener noreferrer"&gt;Docker docs&lt;/a&gt; will give you more information on that.&lt;/li&gt;
&lt;li&gt;AWS account.&lt;/li&gt;
&lt;li&gt;Dockerfile for the script you want to schedule.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What Is AWS Fargate?
&lt;/h3&gt;

&lt;p&gt;For anyone who doesn’t know about AWS Fargate, here is an introduction.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F2s7ww02eq5v9fasaz78i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F2s7ww02eq5v9fasaz78i.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“AWS Fargate is a compute engine for Amazon ECS that allows you to run &lt;a href="http://aws.amazon.com/what-are-containers" rel="noopener noreferrer"&gt;containers&lt;/a&gt; without having to manage servers or clusters.&lt;br&gt;
With AWS Fargate, you no longer have to provision, configure, and scale clusters of virtual machines to run containers. This removes the need to choose server types, decide when to scale your clusters, or optimize cluster packing.&lt;br&gt;
AWS Fargate removes the need for you to interact with or think about servers or clusters. Fargate lets you focus on designing and building your applications instead of managing the infrastructure that runs them.” — &lt;a href="https://aws.amazon.com/fargate/" rel="noopener noreferrer"&gt;https://aws.amazon.com/fargate/&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Before Fargate’s release, the only way to use Amazon ECS was to provide a cluster of EC2 instances managed by Amazon (for software, updates, and configuration).&lt;/p&gt;

&lt;p&gt;Costs of the clusters, scaling of tasks, and configuring and maintaining a valid autoscaling system to avoid lacking adequate container resources were the problems faced.&lt;/p&gt;

&lt;p&gt;AWS Fargate allows for all of this management overhead to be handed to AWS, i.e., to launch container-based services by paying only for the actual execution time. No need to worry about the underlying cluster as AWS will take care of that just fine.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Is Amazon ECS?
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fjkabj6uky20rrjvevj44.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fjkabj6uky20rrjvevj44.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://aws.amazon.com/ecs/" rel="noopener noreferrer"&gt;Elastic Container Service&lt;/a&gt; (ECS) is an AWS service that handles the Docker containers orchestration in your EC2 cluster. It is an alternative for Kubernetes, &lt;a href="https://docs.docker.com/engine/swarm/" rel="noopener noreferrer"&gt;Docker Swarm&lt;/a&gt;, and other orchestration services that also handles the scaling.&lt;/p&gt;

&lt;p&gt;One key feature of this is that Amazon ECS lets you run batch workloads with managed or custom schedulers on Amazon EC2 on-demand instances, reserved instances, or spot instances.&lt;/p&gt;

&lt;p&gt;So, when containers are run on Amazon &lt;a href="https://aws.amazon.com/ec2/spot/" rel="noopener noreferrer"&gt;EC2 spot instances&lt;/a&gt;, we would receive up to a 90% discount compared to on-demand prices. Other than this, you may have many reasons to use Amazon ECS.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Is AWS ECR?
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F27bk3at5hcu95bj27ma9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F27bk3at5hcu95bj27ma9.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, in this process, we are going to use AWS Fargate as well. As we use Docker when we deploy our script, which needs to be scheduled, this would be an easier way.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Amazon Elastic Container Registry (ECR) is a fully-managed &lt;a href="https://aws.amazon.com/docker/" rel="noopener noreferrer"&gt;Docker&lt;/a&gt; container registry that makes it easy for developers to store, manage, and deploy Docker container images.” — &lt;a href="https://aws.amazon.com/ecr/" rel="noopener noreferrer"&gt;https://aws.amazon.com/ecr/&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Another reason to use ECR when we work with ECS is that since ECR and ECS are integrated, it reduces the workflow that we have to go through.&lt;/p&gt;

&lt;p&gt;So, from here onwards, I’ll use a step-by-step approach to describe how to schedule a script with CI/CD in AWS Fargate. If you have completed the prerequisites for these steps you have the Jenkins server configured, a GitHub repo, and an AWS account.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Create a repository in ECR with a proper name.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fb7rtn6sns4n3kj3g0hww.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fb7rtn6sns4n3kj3g0hww.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can use the toggles shown here to activate tag immutability or scan on pushing the image.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fqrlgggjgqxlm100nrv8u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fqrlgggjgqxlm100nrv8u.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Create a new item on Jenkins as a freestyle project.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F8et9ubre5pzcnsgoj5dp.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F8et9ubre5pzcnsgoj5dp.jpeg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Configure the Jenkins pipeline to get the source from the GitHub repo and push the Docker image to the repo in ECR.(Go to the Source Code Management section → select option Git.)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5sxdu1d4aq9q5822u2sz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5sxdu1d4aq9q5822u2sz.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;If you have already configured Jenkins and GitHub using an ssh-key pair as I mentioned earlier, in the Credentials dropdown, you will find the previously configured key.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can specify the branch you want to get the code from, which comes in handy in CI/CD.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go to your ECR and click on the repository that you created. Then click on the view push commands button.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnfe4rjy35fwr2xvy3mmg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnfe4rjy35fwr2xvy3mmg.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Next, we should give the push commands that are specified in the ECR repo to Jenkins. ( Go to the Build section → Click Add build step → Select Execute shell from the dropdown.)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fyate7xvwt0wklvrzsoxf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fyate7xvwt0wklvrzsoxf.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When you’re done configuring it, you can click Apply and then Save. Now the pipeline is done.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 3
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Go to AWS ECS and create the cluster.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5qtq2pxovzrbtfi1g14w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5qtq2pxovzrbtfi1g14w.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can select Networking only from the below choices.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fumm8f0z336fx765ry3eg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fumm8f0z336fx765ry3eg.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Then, you have to give a name for your cluster and any other configurations, such as create a new VPC, tags, and enabling container insights.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fhx5jqunek3bv2ch4zchq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fhx5jqunek3bv2ch4zchq.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Once you press the create button, the cluster will be created and you can view the cluster.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 4
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Create the task definition.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F23ekskjbijitqmgp2xry.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F23ekskjbijitqmgp2xry.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Then you'll get this.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fqu2e4wnps7u56ppla5f4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fqu2e4wnps7u56ppla5f4.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now start configuring the task definition in the following view. Here, you can specify IAM roles, task memory, and task CPU according to your task size.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9z81c7rkm930v9zs9hex.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9z81c7rkm930v9zs9hex.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;While you are configuring, you will have to configure the container as well in the following view, which we get after clicking the Add container button.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fzrfottl6moti18xuy35y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fzrfottl6moti18xuy35y.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Here, the repository URLs/image tag should be taken from the repository you created in ECR. Other configurations, such as adding memory limits, port mapping, and configuring env variables, can also be done here.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 5
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The last step is creating a scheduled task, giving the information on scheduling. (Go to Clusters under Amazon ECS→ Select the cluster you created→ Click the Scheduled Tasks tab→ click the Create button on the top of the table.)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fheoqv1j2jjvkldschzsd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fheoqv1j2jjvkldschzsd.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Here you can choose the schedule rule type. You can either select Run at a fixed interval or Cron expression according to your needs. Here, we have used a cron expression. You can get more information on cron expressions &lt;a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you scroll down, you will be able to see more configurations that you should do regarding the target. You should select Fargate as the launch type and the task definition that you created from the dropdown menu.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;VPC and security groups can be configured here as well.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fkbs1y6xuroukbn8dr9ho.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fkbs1y6xuroukbn8dr9ho.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Once you finish the configuration, you can view your scheduled task under the Scheduled Tasks tab.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So now you can make changes to your script and then push it to the branch you have configured in Jenkins. Then, once you build the image using Jenkins by clicking Build, the Docker image will be pushed to ECR with the tag.&lt;/p&gt;

&lt;p&gt;Then, once it’s done, the scheduled job will be run according to the rules you specified. One more thing that you can do is add the GitHub webhook as well so that the pipeline will be fully automated.&lt;/p&gt;

&lt;p&gt;Please share your results, observations, doubts, and ideas. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;See you soon with another one!&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>devops</category>
      <category>docker</category>
    </item>
  </channel>
</rss>
