Skip to content

Commit 84ab22d

Browse files
committed
Added Glue Job Version Deprecation Checker
1 parent 18ba723 commit 84ab22d

File tree

3 files changed

+98
-4
lines changed

3 files changed

+98
-4
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,14 @@ repository at: [awslabs/aws-glue-libs](https://github.com/awslabs/aws-glue-libs)
5454
You can use this Dockerfile to run Spark history server in your container.
5555
See details: [Launching the Spark History Server and Viewing the Spark UI Using Docker ](https://docs.aws.amazon.com/glue/latest/dg/monitor-spark-ui-history.html#monitor-spark-ui-history-local)
5656

57-
- [use only IAM access controls](utilities/use_only_IAM_access_controls/README.md)
58-
59-
AWS Lake Formation applies its own permission model when you access data in Amazon S3 and metadata in AWS Glue Data Catalog through use of Amazon EMR, Amazon Athena and so on.
60-
If you currently use Lake Formation and instead would like to use only IAM Access controls, this tool enables you to achieve it.
57+
- [use only IAM access controls](utilities/use_only_IAM_access_controls/README.md)
58+
59+
AWS Lake Formation applies its own permission model when you access data in Amazon S3 and metadata in AWS Glue Data Catalog through use of Amazon EMR, Amazon Athena and so on.
60+
If you currently use Lake Formation and instead would like to use only IAM Access controls, this tool enables you to achieve it.
61+
62+
- [Glue Job Version Deprecation Checker](utilities/glue_version_deprecation_checker/README.md)
63+
64+
This command line utility helps you to identify the target Glue jobs which will be deprecated per [AWS Glue version support policy](https://docs.aws.amazon.com/glue/latest/dg/glue-version-support-policy.html).
6165

6266
### GlueCustomConnectors
6367
AWS Glue provides [built-in support](https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-connect.html) for the most commonly used data stores such as Amazon Redshift, MySQL, MongoDB. Powered by Glue ETL Custom Connector, you can subscribe a third-party connector from AWS Marketplace or build your own connector to connect to data stores that are not natively supported.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
## Glue Job Version Deprecation Checker
2+
3+
Per [AWS Glue version support policy](https://docs.aws.amazon.com/glue/latest/dg/glue-version-support-policy.html), Glue jobs using specific versions are going to be deprecated.
4+
This command line utility helps you to identify the target Glue jobs which will be deprecated.
5+
6+
## How to use it
7+
8+
You can run this shell script in any location where you have Bash and the following environment.
9+
10+
### Pre-requisite
11+
* Configure default region. See details: [Configuring the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html)
12+
* Install [AWS CLI](https://aws.amazon.com/cli/)
13+
14+
### Syntax
15+
```
16+
$ ./check_jobs.sh [ -r COMMA_SEPARATED_REGION_NAMES ] [ -p PROFILE_NAME ]
17+
```
18+
19+
* Glue jobs in all regions are listed if the option `-r` is not specified.
20+
21+
### Example 1. Check Glue jobs in all regions
22+
```
23+
$ ./check_jobs.sh
24+
```
25+
26+
### Example 2. Check Glue jobs only in us-east-1 and us-west-2
27+
```
28+
$ ./check_jobs.sh -r us-east-1,us-west-2
29+
```
30+
31+
### Example 3. Check Glue jobs only in us-east-1 and us-west-2 using AWS named profile
32+
```
33+
$ ./check_jobs.sh -r us-west-2 -p test_profile
34+
```
35+
36+
### Example of command output
37+
```
38+
Region: us-west-2
39+
-------------------------------------------------------------------------------------------
40+
| GetJobs |
41+
+-------------+------------------------------------------+--------------+-----------------+
42+
| GlueVersion | JobName | JobType | PythonVersion |
43+
+-------------+------------------------------------------+--------------+-----------------+
44+
| 0.9 | sample_spark_job | glueetl | 2 |
45+
| 1.0 | sample_pythonshell | pythonshell | 2 |
46+
+-------------+------------------------------------------+--------------+-----------------+
47+
```
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: MIT-0
3+
#! /bin/bash
4+
5+
regions=
6+
profile=
7+
8+
usage() {
9+
echo "Usage: $0 [ -r COMMA_SEPARATED_REGION_NAMES ] [ -p PROFILE_NAME ]"
10+
echo " - Glue jobs in all regions are listed if the option '-r' is not specified."
11+
}
12+
13+
exit_abnormal() {
14+
usage
15+
exit 1
16+
}
17+
18+
while getopts r:p:h OPT; do
19+
case $OPT in
20+
p) profile=${OPTARG};;
21+
r) IFS=',' read -r -a regions <<< ${OPTARG};;
22+
*) exit_abnormal;;
23+
esac
24+
done
25+
26+
profile_option=""
27+
if [ ! -z "${profile}" ]
28+
then
29+
echo "Profile: $profile"
30+
profile_option="--profile $profile"
31+
fi
32+
33+
if [ -z "${regions}" ]
34+
then
35+
regions=$(aws ec2 describe-regions --query 'Regions[].{Name:RegionName}' $profile_option --output text|sort -r)
36+
fi
37+
38+
echo "Following Glue jobs are going to be deprecated as per AWS Glue's version support policy. "
39+
for region in $regions
40+
do
41+
echo "Region: $region"
42+
aws glue get-jobs --query 'Jobs[? (GlueVersion==`"0.9"` || GlueVersion==null) && (Command.Name==`"glueetl"` || Command.Name==`"gluestreaming"`) || Command.PythonVersion==`"2"`].{JobName:Name,JobType:Command.Name,GlueVersion:GlueVersion,PythonVersion:Command.PythonVersion}' $profile_option --region $region --output table
43+
done

0 commit comments

Comments
 (0)