-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(terraform): add apache sedona (#12433)
- Loading branch information
1 parent
348b801
commit 458aa97
Showing
4 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
terraform/data/amazon-emr/hm-amazon-emr-cluster-sedona/bootstrap-actions/set_up.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
echo "# Add SSH keys" | ||
echo ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPWhR5NV13iw0X8lKqsrSRqbcIJcA5AVMjyfJjOrplwH hongbo-miao >> /home/hadoop/.ssh/authorized_keys | ||
|
||
echo "# Install Python" | ||
# https://github.com/aws-samples/aws-emr-utilities/blob/main/utilities/emr-ec2-custom-python3/README.md | ||
PYTHON_VERSION=3.11.6 | ||
sudo yum --assumeyes remove openssl-devel* | ||
sudo yum --assumeyes install gcc openssl11-devel bzip2-devel libffi-devel tar gzip wget make expat-devel | ||
curl --silent --fail --show-error --location "https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz" | tar -x -J -v | ||
cd "Python-${PYTHON_VERSION}" | ||
./configure \ | ||
--enable-loadable-sqlite-extensions \ | ||
--with-dtrace \ | ||
--with-lto \ | ||
--enable-optimizations \ | ||
--with-system-expat \ | ||
--prefix="/usr/local/python${PYTHON_VERSION}" | ||
sudo make altinstall | ||
sudo "/usr/local/python${PYTHON_VERSION}/bin/python${PYTHON_VERSION%.*}" -m pip install --upgrade pip | ||
|
||
echo "# Install dependencies" | ||
sudo curl --silent --fail --show-error --location --remote-name --output-dir /usr/lib/spark/jars/ https://repo1.maven.org/maven2/org/apache/sedona/sedona-spark-shaded-3.4_2.12/1.5.0/sedona-spark-shaded-3.4_2.12-1.5.0.jar | ||
sudo curl --silent --fail --show-error --location --remote-name --output-dir /usr/lib/spark/jars/ https://repo1.maven.org/maven2/org/datasyslab/geotools-wrapper/1.5.0-28.2/geotools-wrapper-1.5.0-28.2.jar | ||
"/usr/local/python${PYTHON_VERSION}/bin/python${PYTHON_VERSION%.*}" -m pip install \ | ||
apache-sedona==1.5.0 \ | ||
attrs==23.1.0 \ | ||
descartes==1.1.0 \ | ||
geopandas==0.14.0 \ | ||
matplotlib==3.8.0 \ | ||
pandas==2.1.2 \ | ||
shapely==2.0.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
terraform/modules/hm_amazon_emr_managed_scaling_policy/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/emr_managed_scaling_policy | ||
resource "aws_emr_managed_scaling_policy" "hm_amazon_emr_managed_scaling_policy" { | ||
cluster_id = var.amazon_emr_cluster_id | ||
compute_limits { | ||
unit_type = "InstanceFleetUnits" | ||
minimum_capacity_units = 2 | ||
maximum_capacity_units = var.max_capacity_units | ||
maximum_ondemand_capacity_units = 1 | ||
maximum_core_capacity_units = 1 | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
terraform/modules/hm_amazon_emr_managed_scaling_policy/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
variable "amazon_emr_cluster_id" { | ||
type = string | ||
} | ||
variable "max_capacity_units" { | ||
type = number | ||
} |