LoginSignup
2
0

More than 3 years have passed since last update.

AWS CLIでAmazon Forecastの全リソース削除

Posted at

備忘録的な投稿。順番に消していかないと削除できないのでCLIでやることにした。

Forecastを削除


for i in `aws forecast list-forecasts --max-items 100 --profile hoge | jq -r '.Forecasts[].ForecastArn'`
  do aws forecast delete-forecast --forecast-arn ${i} --profile hoge
done

jq -rじゃないとダブルクォートを認識してしまって上手く行かないので注意。

Predictorを削除


for i in `aws forecast list-predictors --max-items 100 --profile hoge | jq -r '.Predictors[].PredictorArn'`
  do aws forecast delete-predictor --predictor-arn ${i} --profile hoge
done

DatasetImportJobを削除


for i in `aws forecast list-dataset-import-jobs --max-items 100 --profile hoge | jq -r '.DatasetImportJobs[].DatasetImportJobArn'`
  do aws forecast delete-dataset-import-job --dataset-import-job-arn $i --profile hoge
done

Datasetを削除


for i in `aws forecast list-datasets --max-items 100 --profile hoge | jq -r '.Datasets[].DatasetArn'`
  do aws forecast delete-dataset --dataset-arn $i --profile hoge
done

DatasetGroupを削除


for i in `aws forecast list-dataset-groups --max-items 100 --profile hoge | jq -r '.DatasetGroups[].DatasetGroupArn'`
  do aws forecast delete-dataset-group --dataset-group-arn $i --profile hoge
done

これで全部消せたはず。なお、サクッとコンソール上で消せるのでS3に上げたデータは手で削除した。
参考ページ

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0