<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Big Data on Amazon Elastic MapReduce - Medium]]></title>
        <description><![CDATA[A serie of article on how to use Amazon Elastic MapReduce on different simple Big Data use cases - Medium]]></description>
        <link>https://medium.com/big-data-on-amazon-elastic-mapreduce?source=rss----8ef040ee0241---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Big Data on Amazon Elastic MapReduce - Medium</title>
            <link>https://medium.com/big-data-on-amazon-elastic-mapreduce?source=rss----8ef040ee0241---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 21:03:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/big-data-on-amazon-elastic-mapreduce" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Run a Spark job within Amazon EMR in 15 minutes]]></title>
            <link>https://medium.com/big-data-on-amazon-elastic-mapreduce/run-a-spark-job-within-amazon-emr-in-15-minutes-68b02af1ae16?source=rss----8ef040ee0241---4</link>
            <guid isPermaLink="false">https://medium.com/p/68b02af1ae16</guid>
            <category><![CDATA[amazon-s3]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[spark]]></category>
            <category><![CDATA[amazon-emr]]></category>
            <dc:creator><![CDATA[Robin JEAN]]></dc:creator>
            <pubDate>Tue, 09 Jan 2018 15:35:21 GMT</pubDate>
            <atom:updated>2018-01-09T15:58:57.988Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*IYXrZfmJ1aiRUAaX.png" /></figure><p>This tutorial is for Spark developper’s who don’t have any knowledge on Amazon Web Services and want to learn an easy and quick way to run a Spark job on Amazon EMR.</p><blockquote>This tutorial is the first of a serie I want to write on using AWS Services (Amazon EMR in particular) to use Hadoop and Spark components.</blockquote><h3>AWS and Amazon EMR</h3><p>AWS is one of the most used cloud services platform, a lot of services are available, it is very well documented and easy to use.</p><p>A cloud services platform allow users to access on-demand resources (compute power, memory, storage) and services (databases, monitoring, workflow, etc.) via the internet with pay-as-you-go pricing.</p><p>Among all the cool services offered by AWS, we will only use two of them :</p><ul><li>Simple Storage Service (S3), a massively scalable object storage service</li><li>Elastic MapReduce (EMR), a managed cluster platform that simplifies running big data frameworks, such as <a href="https://aws.amazon.com/elasticmapreduce/details/hadoop">Apache Hadoop</a> and <a href="https://aws.amazon.com/elasticmapreduce/details/spark">Apache Spark</a>. It can be view like Hadoop-as-a-Service, you start a cluster with the number of nodes you want, run any job you want and only pay for the time the cluster is actually up.</li></ul><p>You can test a lot of AWS services using the free <a href="https://aws.amazon.com/fr/free/">trial account</a> but for now, EMR is not included so you will have to pay some fees (less than $0.15/hour for a small cluster), but this is nothing compared to all the benefits offered by AWS.</p><p><em>Warning : The bills can be pretty expensive if you forget to shut down all your instances !</em></p><p>Now that we introduced these two services, let’s start using it to run a simple word count !</p><h3>Tutorial</h3><p>The aim of this tutorial is to launch the classic word count Spark Job on EMR. The input and output files will be store using S3 storage. All steps are simples and I will explain how to do it using both AWS UIs and the AWS CLI tool.</p><p>Here is the word count Spark code (using Spark 2.2.0) which will be used :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ba9c135879072e3ce14e1c1e92a8a500/href">https://medium.com/media/ba9c135879072e3ce14e1c1e92a8a500/href</a></iframe><h4>Create an AWS account</h4><p>First of all, create a free trial AWS account on <a href="https://aws.amazon.com/">AWS website</a>. The form is simple and quick to fill, you will need to enter your credit card information which will be used for Amazon EMR pricing and for other services if you use more than the <a href="https://aws.amazon.com/fr/free/">free trial account quotas</a>.</p><h4>For those who want to use AWS CLI</h4><p>If you don’t want to waste time doing the different steps of this tutorial using Amazon Graphic User Interfaces and want to automate it, you can install AWS CLI using <a href="http://docs.aws.amazon.com/cli/latest/userguide/installing.html">this documentation</a>.</p><h4>Choose a region on which deploy the cluster</h4><p>Depending on the date you signed up for an AWS account, the default region when you access a resource from the AWS Management Console is different. Each region have his own type of resources and pricing. The aim of this tutorial is to present how to run a Spark job, we don’t really care about performances. That is why, to minimize the Amazon bill, I invite you to compare the <a href="https://aws.amazon.com/fr/emr/pricing/">Amazon EMR pricing</a> and <a href="https://aws.amazon.com/s3/pricing/">Amazon S3 pricing</a> to choose the cheapest region and configuration.</p><p><em>I didn‘t know that when I launched an Amazon EMR cluster for the first time. My bill was three times the price I could have pay if I deployed the cluster on another region.</em></p><p>You can change the region by clicking at the up-right corner on each of the different AWS Management console</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/329/0*kD3rYJZMBlK47t4G." /></figure><blockquote><em>Using AWS CLI </em><a href="http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html"><strong><em>aws configure</em></strong></a><em> you can specify the default region among </em><a href="https://docs.aws.amazon.com/general/latest/gr/rande.html#apigateway_region"><em>this list of regions</em></a><em>.</em></blockquote><pre>$ aws configure<br>AWS Access Key ID [None]: <em>AKIAIOSFODNN7EXAMPLE</em><br>AWS Secret Access Key [None]: <em>wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLE</em><br>Default region name [None]: <em>us-west-2</em><br>Default output format [None]: <em>json</em></pre><h4>Create an Amazon S3 Bucket</h4><p>In this use case, we will use Amazon S3 bucket to store our Spark application jar, logs, input and output files.</p><ol><li>Open the <a href="https://console.aws.amazon.com/s3/">Amazon S3 console</a></li><li>Choose <strong>Create bucket</strong></li><li><strong>Type a name</strong> for your bucket (ex : my-first-emr-bucket) and <strong>choose its AWS Region</strong> then <strong>click next.</strong></li><li>On the <strong>Set properties page</strong>, you can configure some properties for the bucket. In this tutorial we don’t need any specific properties, <strong>click next</strong>.</li><li>On the <strong>Set permissions page</strong>, you manage permissions that are set on the bucket that you are creating. We will use the default permissions, <strong>click next</strong>.</li><li>On the <strong>Review page</strong>, verify the settings and choose <strong>Create bucket</strong>.</li></ol><blockquote><em>Using AWS CLI </em><a href="http://docs.aws.amazon.com/cli/latest/reference/s3api/create-bucket.html"><strong><em>aws s3api create-bucket</em></strong></a></blockquote><pre>$ aws s3api create-bucket \<br>     --bucket my-second-emr-bucket \<br>     --region us-east-2 \<br>     --create-bucket-configuration LocationConstraint=us-east-2</pre><h3>Upload files on Amazon S3</h3><p>Now that our S3 bucket is created, we will upload the Spark application jar and an input file on which we will apply the wordcount.</p><ol><li>On the Amazon S3 console <strong>click on the bucket</strong> you just created</li><li>Choose <strong>Create folder</strong>, <strong>enter the name </strong>of the folder (ex : tutorialEMR), the encryption setting (ex : None) and <strong>save</strong></li><li><strong>Click on the folder</strong> you just created, then choose <strong>upload</strong> to upload the <strong>Spark application jar</strong> and the <strong>input text file</strong> on which you want to apply the wordcount</li></ol><blockquote><em>Using AWS CLI, use </em><a href="http://docs.aws.amazon.com/cli/latest/reference/s3/sync.html"><strong><em>aws s3 sync</em></strong></a><em> to upload the directory containing the Spark application jar and the input text file</em></blockquote><pre>$ aws s3 sync tutorialEMR/ s3://my-second-emr-bucket/tutorialEMR</pre><h4>Create an Amazon EMR cluster &amp; Submit the Spark Job</h4><p>In this step, we will launch a sample cluster running the Spark job and terminating automatically after the execution.</p><ol><li>Open the <a href="https://console.aws.amazon.com/elasticmapreduce/">Amazon EMR console</a></li><li>On the right left corner, <strong>change the region</strong> on which you want to deploy the cluster</li><li>Choose <strong>Create cluster</strong></li><li>On the <strong>General Configuration </strong>section, enter the cluster name, <strong>choose the S3 bucket</strong> you created (the logs will be stored in this bucket) and <strong>check Step execution.</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/0*aM7GhQ2PzN50ESwu." /></figure><p>5. On the <strong>Add steps </strong>section, <strong>select Spark application</strong>, click <strong>Configure </strong>and fill the popup like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/914/0*0MrBBEGvYEu3B9J9." /></figure><p>6. On the <strong>Software Configuration </strong>section, use the default release (the last one)</p><p>7. On the <strong>Hardware configuration</strong> section, <strong>choose the instance</strong> type and <strong>the number of instances</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/0*jtCpFLg-W-vnNWuM." /></figure><p>8. On the <strong>Security and access</strong> section, use the Default values<strong>.</strong></p><p>9. Click on <strong>Create cluster</strong></p><p>10. Click on <strong>the refresh icon</strong> to see the status passing from Starting to Running to Terminating — All steps completed</p><p>11. Now go back to the S3 console and you will see the output directory in which the result has been stored, you can click on it and download its contents</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1015/0*rXTahDmAoiiWhoia." /></figure><blockquote><em>Using AWS CLI</em></blockquote><ol><li><a href="http://docs.aws.amazon.com/cli/latest/reference/emr/create-default-roles.html"><strong>Create default roles</strong></a> which will be used to create the cluster</li></ol><pre>$ aws emr create-default-roles</pre><p>2. <a href="http://docs.aws.amazon.com/cli/latest/reference/ec2/describe-subnets.html"><strong>Find the SubnetId</strong></a> of our default region</p><pre>$ aws ec2 describe-subnets \<br>     --filters &quot;Name=availabilityZone,Values=us-east-2b&quot;</pre><p>3. <a href="http://docs.aws.amazon.com/cli/latest/reference/emr/create-cluster.html"><strong>Create the cluster</strong></a> and submit the Spark step</p><pre>$ aws emr create-cluster \<br>     --name “Cluster” \<br>     --release-label emr-5.9.0 \<br>     --instance-type m4.large — instance-count 3 \<br>     --applications Name=Spark \<br>     --steps Type=Spark,Name=”Spark Program”,ActionOnFailure=CONTINUE,Args=[ — class,com.jeanr84.sparkjob.SparkJob,s3://my-second-emr-bucket/tutorialEMR/spark-job-0.0.1-SNAPSHOT.jar,s3://my-second-emr-bucket/tutorialEMR/input.txt,s3://my-second-emr-bucket/tutorialEMR/output] \<br>     --use-default-roles \<br>     --ec2-attributes SubnetId=subnet-e7ba9d9c \<br>     --auto-terminate</pre><p>4. Download locally the result repository</p><pre>$ aws s3 sync s3://my-second-emr-bucket/tutorialEMR/output output</pre><h3>Conclusion</h3><p>Easy, isn’t it ? You learnt how to simply use AWS services in order to run a Spark job ! As mentioned before, this is the first article I write on Medium, any suggestions and feedbacks are welcome to improve it. I will soon write other articles on AWS related to Big Data on this story (certainly on using <strong>Apache Oozie</strong> to submit a Spark job on Amazon EMR).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=68b02af1ae16" width="1" height="1" alt=""><hr><p><a href="https://medium.com/big-data-on-amazon-elastic-mapreduce/run-a-spark-job-within-amazon-emr-in-15-minutes-68b02af1ae16">Run a Spark job within Amazon EMR in 15 minutes</a> was originally published in <a href="https://medium.com/big-data-on-amazon-elastic-mapreduce">Big Data on Amazon Elastic MapReduce</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>