aws-nuke
aws-nuke copied to clipboard
Adding rekognition project and dataset support.
This PR includes two new modules for AWS Rekognition.
Testing
Rekognition resources were created using the setup code mentioned below, and then AWS Nuke was used to clean these resources up, specifying :
"RekognitionDataset"
"RekognitionProject"
"RekognitionCollection" (Support already existing)
Note: Rekogniton datasets do not have list functions available. This info has been parsed from the DescribeProjects call.
Setup code
#!/bin/bash
set -ex
# Generate a random string to use as a bucket name and classifier name suffix
RANDOM_STRING=$(openssl rand -hex 20)
# Generate a random string for shorter names
SHORT_RANDOM_STRING=$(openssl rand -hex 10)
# Get AWS account ID
AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query "Account" --output text)
echo "AWS Account ID: $AWS_ACCOUNT_ID"
# Create a Rekognition project
REKOGNITION_PROJECT_NAME="test-rekognition-project-$SHORT_RANDOM_STRING"
aws rekognition create-project --project-name "$REKOGNITION_PROJECT_NAME" --output text > project_arn.txt
# Get the project ARN from the output and assign it to a variable
PROJECT_ARN=$(cat project_arn.txt)
echo "Rekognition Project ARN: $PROJECT_ARN"
# Create a Rekognition dataset using the project ARN
DATASET_TYPE="TRAIN" # Replace with your dataset type
aws rekognition create-dataset --project-arn $PROJECT_ARN \
--dataset-type $DATASET_TYPE \
--output text > dataset_arn.txt
DATASET_ARN=$(cat dataset_arn.txt)
echo "Rekognition Dataset ARN: $DATASET_ARN"
# Create a Rekognition collection
aws rekognition create-collection --collection-id test-collection-$RANDOM_STRING --output text > collection_arn.txt
# Get the project ARN from the output and assign it to a variable
COLLECTION_ARN=$(cat collection_arn.txt)
echo "Rekognition Colection ARN: $COLLECTION_ARN"
# Describe projects
aws rekognition describe-projects
# List collections
aws rekognition list-collections
# List datasets
aws rekognition describe-dataset --dataset-arn $DATASET_ARN