You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: emr-serverless-spark/README.md
+25-7Lines changed: 25 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,12 +5,28 @@ We will run a Java Spark job on EMR Serverless using a simple Java "Hello World"
5
5
## Prerequisites
6
6
7
7
* LocalStack
8
-
*`aws` CLI & `awslocal` script
8
+
*`aws` CLI
9
9
* Docker
10
10
* Java and Maven
11
11
12
12
## Installation
13
13
14
+
### Configuring a custom profile
15
+
Configure a custom profile to use with LocalStack. Add the following profile to your AWS configuration file (by default, this file is at ~/.aws/config):
16
+
```shell
17
+
[profile localstack]
18
+
region=us-east-1
19
+
output=json
20
+
endpoint_url = http://localhost:4566
21
+
```
22
+
23
+
Add the following profile to your AWS credentials file (by default, this file is at ~/.aws/credentials):
24
+
```shell
25
+
[localstack]
26
+
aws_access_key_id=test
27
+
aws_secret_access_key=test
28
+
```
29
+
14
30
Before creating the EMR Serverless job, we need to create a JAR file containing the Java code. We have the `java-demo-1.0.jar` file in the current directory. Alternatively, you can create the JAR file yourself by following the steps below.
15
31
16
32
```bash
@@ -21,14 +37,15 @@ mvn package
21
37
Next, we need to create an S3 bucket to store the JAR file. To do this, run the following command:
22
38
23
39
```bash
40
+
cd ..
24
41
export S3_BUCKET=test
25
-
awslocal s3 mb s3://$S3_BUCKET
42
+
aws s3 mb s3://$S3_BUCKET
26
43
```
27
44
28
45
You can now copy the JAR file from your current directory to the S3 bucket:
The Spark logs will be written to the S3 bucket specified in the `logUri` parameter. You can stop the EMR Serverless application with the following command:
0 commit comments