1
0

はじめに

お疲れ様です。yuki_inkです。
先日、以下の記事を執筆しました。

この記事では「リソース全削除ボタン」という極端な例を想定しており、削除対象のリソースを定義する設定ファイル nuke_generic_config.yaml の記述は ガバガバ でした。
実際にaws-nukeを利用するとなると、フィルターの設定など、ちゃんと考える必要があります。

事故の起きないような形でaws-nukeを使っていただきたいという思いから、この記事では、aws-nukeの設定ファイル nuke_generic_config.yaml の記述の仕方についてまとめます。

最後に、aws-nukeを利用するにあたってのTipsを残しておきます。

前提

aws-nukeの環境構築については、以前の記事をご参照ください。

今回詳細に記すのは、1.4. nuke_generic_config.yaml の修正 で修正している設定ファイル nuke_generic_config.yaml のお話です。

なお、設定ファイルは nuke-config.yaml と命名される場合もあります(というかそっちのほうが多数派?)
この記事では便宜上設定ファイルを nuke_generic_config.yaml として記述しますが、 nuke-config.yaml に読み替えていただいて問題ありません。

aws-nukeのバージョンアップが行われ、この記事に記載している内容が最新情報でない可能性があります。
詳細は公式の README.md をご確認ください。

設定ファイル(yaml)の構成

設定ファイルの構成要素としては以下の通りです。

  • regions: 対象のリージョンを指定(必須)
  • account-blocklist:指定したアカウントをnukeの削除対象から除外(必須)
  • resource-types
    • excludes: 指定したサービスをnukeの削除対象から除外
    • targets: 削除の対象とするサービスを明示的に指定
  • accounts: 対象のアカウントを指定。アカウント別に、タグの値などを利用して削除するリソースを絞り込む(必須)
  • feature-flags: その他のオプション(削除保護がついている場合の挙動の指定など)

以下に記述例を示します。
(参考)aws-nukeで作るマルチアカウントのお掃除機能

nuke_generic_config.yaml
regions:
  # add `global` here to include IAM entities to be nuked
  # nukeでリソースを削除する対象のリージョンをリストアップします
  - ap-northeast-1 
  - us-east-1

account-blocklist:
  - 123456789012 # 削除対象から外すアカウントをリストアップします

# optional: restrict nuking to these resources
resource-types:
  excludes: # 削除の対象外とするリソースをリストアップします
    - IAMUser
    - IAMUserPolicyAttachment
    - IAMUserAccessKey
    - IAMLoginProfile
    - IAMGroup
    - IAMRolePolicy
    - IAMRolePolicyAttachment
    - IAMPolicy
    - CloudTrailTrail

  targets: # 削除対象とするサービスをリストアップします
    - RDSInstance
    - EC2Instance
    - EC2Image
    - CloudFormationStack
    - LightsailInstance

accounts:
  ACCOUNT: # ACCOUNTという文字列はCodeBuild内で実際のアカウントIDに書き換えられます
    filters: # 特定のタグがついたリソースを削除対象外にできます
      EC2Instance:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      RDSInstance:
      - type: exact
        property: tag:DoNotNuke
        value: "true"

feature-flags:
  disable-deletion-protection:
    RDSInstance: true
    EC2Instance: true
    CloudformationStack: true
  force-delete-lightsail-addons: true

それぞれのセクションについて、以下に詳述していきます。

resource-types セクション配下に cloud-control を定義し、aws-nukeがまだサポートしていないAWSサービスについても削除対象とすることができるようになるとのこと。
残念ながら、記事執筆時点では This feature is not yet released とのことです。
image.png

regions(必須項目)

リソース削除の対象リージョンをリストアップします。
IAMユーザなど、IAM関連のリソースを削除対象とする際は global を含めてください。

regions:
- global
- eu-west-1
- ap-northeast-1

account-blocklist(必須項目)

本番環境のアカウントなど、絶対に触りたくないアカウントをリストアップします。

必須項目となっており、これを記載しないと動きません!
特に触りたくないアカウントなんてないよ、という方は、例をそのまま利用してください。

account-blocklist:
  - 123456789012

resource-types

excludestargets の2つの要素があります。

excludes と targets の使い分け

  • excludes はいわゆる「ブラックリスト方式」でのリソース指定です。
    excludes で記述したもの以外のリソースが削除対象となります。
  • targets は単純に、そこに記述したリソースが削除対象となります。

excludestargets 両方を記述すると、targets の内容が優先されます。
excludestargets 両方に同じリソースを記述すると、excludes が優先され、削除対象ではなくなります。

resource-types:
  excludes: # 削除の対象外とするリソースをリストアップします
    - IAMUser
    - IAMUserPolicyAttachment
    - IAMUserAccessKey
    - IAMLoginProfile
    - IAMGroup
    - IAMRolePolicy
    - IAMRolePolicyAttachment
    - IAMPolicy
    - CloudTrailTrail

  targets: # 削除対象とするサービスをリストアップします
    - RDSInstance
    - EC2Instance
    - EC2Image
    - CloudFormationStack
    - LightsailInstance

とりあえずのガードレールとして excludes は書いておきましょう。
※CloudTrail とか IAM とか、、

そのうえで、targets に削除対象のリソースを書くようにすると安全です。
excludes に書いたもの以外のリソースを一掃したい場合は、targets を記述しなければOKです。

resource-types は、aws-nukeの仕様的には必須項目ではありませんが、ここを記載しないと、全てのリソースが削除対象となってしまいます!
必須項目として認識しておきましょう!

CloudFormationStackCloudFormationStackSetexcludes に書いたとしても、そのスタックの上に乗っているリソースが excludes に書かれていなければ、そのリソースは削除対象となります。
その逆も然りです。
ですので、CloudFormationでリソースを管理されている場合は、注意してください。
※後続の accounts の章で説明するフィルタリングも利用して、スタックとその上に乗っているリソースの両面から考慮するようにしてください。

resource-types に記述するリソース識別子

aws-nukeには、独自に定められたリソースの識別子があるようで、その識別子を使って記述していきます。
記事執筆時点での識別子一覧は以下の通り。

リソース識別子一覧
ACMCertificate
ACMPCACertificateAuthority
ACMPCACertificateAuthorityState
AMGWorkspace
AMPWorkspace
APIGatewayAPIKey
APIGatewayClientCertificate
APIGatewayDomainName
APIGatewayRestAPI
APIGatewayUsagePlan
APIGatewayV2API
APIGatewayV2VpcLink
APIGatewayVpcLink
AWS::AppFlow::ConnectorProfile
AWS::AppFlow::Flow
AWS::AppRunner::Service
AWS::ApplicationInsights::Application
AWS::Backup::Framework
AWS::ECR::PublicRepository
AWS::ECR::PullThroughCacheRule
AWS::ECR::RegistryPolicy
AWS::ECR::ReplicationConfiguration
AWS::MWAA::Environment
AWS::NetworkFirewall::Firewall
AWS::NetworkFirewall::FirewallPolicy
AWS::NetworkFirewall::RuleGroup
AWS::Synthetics::Canary
AWS::Timestream::Database
AWS::Timestream::ScheduledQuery
AWS::Timestream::Table
AWS::Transfer::Workflow
AWSBackupPlan
AWSBackupRecoveryPoint
AWSBackupSelection
AWSBackupVault
AWSBackupVaultAccessPolicy
AccessAnalyzer
AppConfigApplication
AppConfigConfigurationProfile
AppConfigDeploymentStrategy
AppConfigEnvironment
AppConfigHostedConfigurationVersion
AppMeshGatewayRoute
AppMeshMesh
AppMeshRoute
AppMeshVirtualGateway
AppMeshVirtualNode
AppMeshVirtualRouter
AppMeshVirtualService
AppRunnerConnection
AppRunnerService
AppStreamDirectoryConfig
AppStreamFleet
AppStreamFleetState
AppStreamImage
AppStreamImageBuilder
AppStreamImageBuilderWaiter
AppStreamStack
AppStreamStackFleetAttachment
AppSyncGraphqlAPI
ApplicationAutoScalingScalableTarget
ArchiveRule
AthenaNamedQuery
AthenaWorkGroup
AutoScalingGroup
AutoScalingPlansScalingPlan
BatchComputeEnvironment
BatchComputeEnvironmentState
BatchJobQueue
BatchJobQueueState
BillingCostandUsageReport
Budget
Cloud9Environment
CloudDirectoryDirectory
CloudDirectorySchema
CloudFormationStack
CloudFormationStackSet
CloudFormationType
CloudFrontDistribution
CloudFrontDistributionDeployment
CloudFrontFunction
CloudFrontKeyGroup
CloudFrontOriginAccessControl
CloudFrontOriginAccessIdentity
CloudFrontOriginRequestPolicy
CloudFrontPublicKey
CloudHSMV2Cluster
CloudHSMV2ClusterHSM
CloudSearchDomain
CloudTrailTrail
CloudWatchAlarm
CloudWatchDashboard
CloudWatchEventsBuses
CloudWatchEventsRule
CloudWatchEventsTarget
CloudWatchLogsDestination
CloudWatchLogsLogGroup
CloudWatchLogsResourcePolicy
CloudWatchRUMApp
CodeArtifactDomain
CodeArtifactRepository
CodeBuildProject
CodeCommitRepository
CodeDeployApplication
CodePipelinePipeline
CodeStarConnection
CodeStarNotificationRule
CodeStarProject
CognitoIdentityPool
CognitoIdentityProvider
CognitoUserPool
CognitoUserPoolClient
CognitoUserPoolDomain
ComprehendDocumentClassifier
ComprehendDominantLanguageDetectionJob
ComprehendEndpoint
ComprehendEntitiesDetectionJob
ComprehendEntityRecognizer
ComprehendEventsDetectionJob
ComprehendKeyPhrasesDetectionJob
ComprehendPiiEntititesDetectionJob
ComprehendSentimentDetectionJob
ComprehendTargetedSentimentDetectionJob
ConfigServiceConfigRule
ConfigServiceConfigurationRecorder
ConfigServiceDeliveryChannel
DAXCluster
DAXParameterGroup
DAXSubnetGroup
DataPipelinePipeline
DatabaseMigrationServiceCertificate
DatabaseMigrationServiceEndpoint
DatabaseMigrationServiceEventSubscription
DatabaseMigrationServiceReplicationInstance
DatabaseMigrationServiceReplicationTask
DatabaseMigrationServiceSubnetGroup
DeviceFarmProject
DirectoryServiceDirectory
DynamoDBTable
DynamoDBTableItem
EC2Address
EC2ClientVpnEndpoint
EC2ClientVpnEndpointAttachment
EC2CustomerGateway
EC2DHCPOption
EC2DefaultSecurityGroupRule
EC2EgressOnlyInternetGateway
EC2Host
EC2Image
EC2Instance
EC2InstanceConnectEndpoint
EC2InternetGateway
EC2InternetGatewayAttachment
EC2KeyPair
EC2LaunchTemplate
EC2NATGateway
EC2NetworkACL
EC2NetworkInterface
EC2PlacementGroup
EC2RouteTable
EC2SecurityGroup
EC2Snapshot
EC2SpotFleetRequest
EC2Subnet
EC2TGW
EC2TGWAttachment
EC2VPC
EC2VPCEndpoint
EC2VPCEndpointConnection
EC2VPCEndpointServiceConfiguration
EC2VPCPeeringConnection
EC2VPNConnection
EC2VPNGateway
EC2VPNGatewayAttachment
EC2Volume
ECRRepository
ECSCluster
ECSClusterInstance
ECSService
ECSTask
ECSTaskDefinition
EFSFileSystem
EFSMountTarget
EKSCluster
EKSFargateProfiles
EKSNodegroups
ELB
ELBv2
ELBv2TargetGroup
EMRCluster
EMRSecurityConfiguration
ESDomain
ElasticBeanstalkApplication
ElasticBeanstalkEnvironment
ElasticTranscoderPipeline
ElasticacheCacheCluster
ElasticacheCacheParameterGroup
ElasticacheReplicationGroup
ElasticacheSubnetGroup
ElasticacheUser
ElasticacheUserGroup
FMSNotificationChannel
FMSPolicy
FSxBackup
FSxFileSystem
FirehoseDeliveryStream
GlobalAccelerator
GlobalAcceleratorEndpointGroup
GlobalAcceleratorListener
GlueClassifier
GlueConnection
GlueCrawler
GlueDataBrewDatasets
GlueDataBrewJobs
GlueDataBrewProjects
GlueDataBrewRecipe
GlueDataBrewRulesets
GlueDataBrewSchedules
GlueDatabase
GlueDevEndpoint
GlueJob
GlueTrigger
GuardDutyDetector
IAMGroup
IAMGroupPolicy
IAMGroupPolicyAttachment
IAMInstanceProfile
IAMInstanceProfileRole
IAMLoginProfile
IAMOpenIDConnectProvider
IAMPolicy
IAMRole
IAMRolePolicy
IAMRolePolicyAttachment
IAMSAMLProvider
IAMServerCertificate
IAMServiceSpecificCredential
IAMSigningCertificate
IAMUser
IAMUserAccessKey
IAMUserGroupAttachment
IAMUserPolicy
IAMUserPolicyAttachment
IAMUserSSHPublicKey
IAMVirtualMFADevice
ImageBuilderComponent
ImageBuilderDistributionConfiguration
ImageBuilderImage
ImageBuilderInfrastructureConfiguration
ImageBuilderPipeline
ImageBuilderRecipe
Inspector2
InspectorAssessmentRun
InspectorAssessmentTarget
InspectorAssessmentTemplate
IoTAuthorizer
IoTCACertificate
IoTCertificate
IoTJob
IoTOTAUpdate
IoTPolicy
IoTRoleAlias
IoTStream
IoTThing
IoTThingGroup
IoTThingType
IoTThingTypeState
IoTTopicRule
KMSAlias
KMSKey
KendraIndex
KinesisAnalyticsApplication
KinesisStream
KinesisVideoProject
LambdaEventSourceMapping
LambdaFunction
LambdaLayer
LaunchConfiguration
LexBot
LexIntent
LexModelBuildingServiceBotAlias
LexSlotType
LifecycleHook
LightsailDisk
LightsailDomain
LightsailInstance
LightsailKeyPair
LightsailLoadBalancer
LightsailStaticIP
MGNJob
MGNSourceServer
MQBroker
MSKCluster
MSKConfiguration
MachineLearningBranchPrediction
MachineLearningDataSource
MachineLearningEvaluation
MachineLearningMLModel
Macie
MediaConvertJobTemplate
MediaConvertPreset
MediaConvertQueue
MediaLiveChannel
MediaLiveInput
MediaLiveInputSecurityGroup
MediaPackageChannel
MediaPackageOriginEndpoint
MediaStoreContainer
MediaStoreDataItems
MediaTailorConfiguration
MemoryDBACL
MemoryDBCluster
MemoryDBParameterGroup
MemoryDBSubnetGroup
MemoryDBUser
MobileProject
NeptuneCluster
NeptuneInstance
NetpuneSnapshot
OSDomain
OSPackage
OSVPCEndpoint
OpsWorksApp
OpsWorksCMBackup
OpsWorksCMServer
OpsWorksCMServerState
OpsWorksInstance
OpsWorksLayer
OpsWorksUserProfile
QLDBLedger
RDSClusterSnapshot
RDSDBCluster
RDSDBClusterParameterGroup
RDSDBParameterGroup
RDSDBSubnetGroup
RDSEventSubscription
RDSInstance
RDSOptionGroup
RDSProxy
RDSSnapshot
RedshiftCluster
RedshiftParameterGroup
RedshiftScheduledAction
RedshiftSnapshot
RedshiftSubnetGroup
RekognitionCollection
ResourceGroupGroup
RoboMakerRobotApplication
RoboMakerSimulationApplication
RoboMakerSimulationJob
Route53HealthCheck
Route53HostedZone
Route53ResolverEndpoint
Route53ResolverRule
Route53ResourceRecordSet
Route53TrafficPolicy
S3AccessPoint
S3Bucket
S3MultipartUpload
S3Object
SESConfigurationSet
SESIdentity
SESReceiptFilter
SESReceiptRuleSet
SESTemplate
SFNStateMachine
SNSEndpoint
SNSPlatformApplication
SNSSubscription
SNSTopic
SQSQueue
SSMActivation
SSMAssociation
SSMDocument
SSMMaintenanceWindow
SSMParameter
SSMPatchBaseline
SSMResourceDataSync
SageMakerApp
SageMakerDomain
SageMakerEndpoint
SageMakerEndpointConfig
SageMakerModel
SageMakerNotebookInstance
SageMakerNotebookInstanceLifecycleConfig
SageMakerNotebookInstanceState
SageMakerUserProfiles
SecretsManagerSecret
SecurityHub
ServiceCatalogConstraintPortfolioAttachment
ServiceCatalogPortfolio
ServiceCatalogPortfolioProductAttachment
ServiceCatalogPortfolioShareAttachment
ServiceCatalogPrincipalPortfolioAttachment
ServiceCatalogProduct
ServiceCatalogProvisionedProduct
ServiceCatalogTagOption
ServiceCatalogTagOptionPortfolioAttachment
ServiceDiscoveryInstance
ServiceDiscoveryNamespace
ServiceDiscoveryService
SignerSigningJob
SimpleDBDomain
StorageGatewayFileShare
StorageGatewayGateway
StorageGatewayTape
StorageGatewayVolume
TransferServer
TransferServerUser
WAFRegionalByteMatchSet
WAFRegionalByteMatchSetIP
WAFRegionalIPSet
WAFRegionalIPSetIP
WAFRegionalRateBasedRule
WAFRegionalRateBasedRulePredicate
WAFRegionalRegexMatchSet
WAFRegionalRegexMatchTuple
WAFRegionalRegexPatternSet
WAFRegionalRegexPatternString
WAFRegionalRule
WAFRegionalRuleGroup
WAFRegionalRulePredicate
WAFRegionalWebACL
WAFRegionalWebACLRuleAttachment
WAFRule
WAFWebACL
WAFWebACLRuleAttachment
WAFv2IPSet
WAFv2RegexPatternSet
WAFv2RuleGroup
WAFv2WebACL
WorkSpacesWorkspace
XRayGroup
XRaySamplingRule

aws-nukeのリソース識別子は独自に割り当てられているため、実際のAWSリソースとの紐づけがあいまいなこともあります。
aws-nuke実行時は、事前に必ずdry-runを行い、意図した通りの挙動となるか確認を行いましょう。

リソース識別子の確認方法

リソース識別子はaws-nukeのバージョンアップにより修正される可能性があります。
以下の流れで最新の情報を確認しましょう。

(1) CloudShellに最新のaws-nukeをインストール

以下の手順を参考にして、CloudShellにaws-nukeをインストールします。

記事執筆時点で、aws-nukeの最新版は 2.25.0 だったので、CloudShellでは以下のようなコマンドを実行しました。

$ wget -c https://github.com/rebuy-de/aws-nuke/releases/download/v2.25.0/aws-nuke-v2.25.0-linux-amd64.tar.gz

$ tar -zxvf aws-nuke-v2.25.0-linux-amd64.tar.gz

(2) リソース識別子の確認

CloudShellで以下のコマンドを打鍵して、識別子の一覧を取得します。

$ ./aws-nuke-v2.25.0-linux-amd64 resource-types
ACMCertificate
ACMPCACertificateAuthority
ACMPCACertificateAuthorityState
AMGWorkspace
AMPWorkspace
APIGatewayAPIKey
APIGatewayClientCertificate
APIGatewayDomainName
…

accounts(必須項目)

削除対象のリソースが存在するアカウントをリストアップします。

accounts:
  000000000000: {}

記事冒頭の「前提」で示した手順で構築した環境(Step FunctionsとCodeBuildを使った構成)の場合、個別のアカウントIDを意識することはありません。
ACCOUNT という文字列を自動でアカウントIDに置き換えてくれます。

フィルタリング(特定のリソースを削除対象外とする)

accounts セクションの filters を利用し、リソース削除の細かい制御を行うことが可能です。
現時点では、以下5つのタイプを使ってフィルタリングができます。
いずれも、フィルターに引っかかったリソースが削除対象外となります。

  • exact
    完全一致の文字列で指定(デフォルト)
  • contains
    部分一致の文字列で指定
  • glob
    *? などのワイルドカードを利用して指定
  • regex
    正規表現で指定
  • dateOlderThan
    日時で指定
    ※ "Older" = "より後の~" という意味であることに注意
# exact の例
    ## タイプを明示しなければ、デフォルトでexact
    S3Bucket:
    - "s3://my-bucket"

    ## "DoNotNuke"タグの値が"true"のVPC
    EC2VPC:
    - type: exact
      property: tag:DoNotNuke
      value: "true"

# contains の例
    ## "ProdRole"という文字列を含むIAMロール
    IAMRole:
    - type: contains
      value: "ProdRole"

# glob の例
    ## adminという名前のIAMユーザーに関連する全てのアクセスキー
    IAMUserAccessKey:
    - type: glob
      value: "admin -> *"

# regex の例
    ## 全てのCloudTrail証跡
    CloudTrailTrail:
    - type: regex
      value: ".*"

# dateOlderThan の例
    ## 24時間以内に起動しているEC2インスタンス
    EC2Instance:
    - property: LaunchTime
      type: dateOlderThan
      value: 24h

dateOlderThan のvalueで指定できるフォーマットについて、公式では以下のように案内されていますが、私の環境ではうまくいきませんでした。
※書き方が悪かった可能性もあります

formats are epoch time, 2006-01-02, 2006/01/02, 2006-01-02T15:04:05Z, 2006-01-02T15:04:05.999999999Z07:00, and 2006-01-02T15:04:05Z07:00.

上記例の 24h のように、「何時間前」で指定できることは確認済みなので、時間単位で頑張っていただくのがよいのかなと思います。
ちなみに、日単位 d で指定できるかなと思い、やってみましたがダメでした。
今後のアップデートに期待。

フィルタリングの便利機能① invert

フィルター結果は invert: true を使用することで反転できます。
以下の例の場合、"foo" という名前のスタック 以外の 全てのスタックがフィルター(削除対象から除外)されます。

CloudFormationStack:
- property: Name
  value: "foo"
  invert: true

フィルタリングの便利機能② Filter Presets

お気づきかと思いますが、フィルターの設定は、"アカウントごと" かつ "リソース識別子ごと" に記述していく必要があります。

控えめに言ってめんどくさすぎる!!
そんなときに役立ちそうなのが Filter Presets です。
公式によると、以下の要領でフィルターの設定をまとめられるようです。
"アカウントごと" の記述の手間が省けそうですね。

accounts:
  555421337:
    presets:
    - "common"
  555133742:
    presets:
    - "common"
    - "terraform"
  555134237:
    presets:
    - "common"
    - "terraform"
    filters:
      EC2KeyPair:
      - "notebook"

presets:
  terraform:
    filters:
      S3Bucket:
      - type: glob
        value: "my-statebucket-*"
      DynamoDBTable:
      - "terraform-lock"
  common:
    filters:
      IAMRole:
      - "OrganizationAccountAccessRole"

Filter Presetsについては未検証です。
上記は公式の記載を転載したものになります。

feature-flags

削除保護を無効化し、削除保護がついているリソースも強制的に削除できるようなオプションを記述します。
こちらについては公式にも細かい案内がなく、以下の例が示されているのみです。
現時点では、削除保護がついているリソースも削除したいときに利用するオプションと認識しておけばよいと思います。

feature-flags:
  disable-deletion-protection:
    RDSInstance: true
    EC2Instance: true
    CloudformationStack: true
  force-delete-lightsail-addons: true

Tips

普段意識しないリソースの削除に注意

以下のようなことが起こりえますので、注意してください。

  • サブネット EC2Subnet は残したけど、ルートテーブル EC2RouteTable が消えてしまった
  • インターネットゲートウェイ EC2InternetGateway は残したけど、VPCとの関連付け EC2InternetGatewayAttachment が消えてしまった

必ず事前にdry-run

dry-runを行うと、以下のような出力になります。

  • excludes に書いたリソースはそもそも表示されない(おそらくクローリングの対象外になっている)
  • 削除されるものは would remove と表示される
  • 削除されないもの(フィルター設定で削除対象から除外されているもの)は filtered by config と表示される

dry-runを実行して、excludes に書いたはずのリソース、あるいはフィルターの設定で削除対象外としたはずのリソースが would remove と表示されていないかを 必ず確認しましょう!

特定のタグが付いているリソースを削除対象外にする

「明日nukeするから、消したくないないリソースには DoNotNuke タグ付けて、値に true って入れといて!」って言えたら楽ですよね。
しかし、ここまで読んでいただいた方ならお分かりかと思いますが、設定書くのがダルい!

というわけで、上記のシチュエーションで使える省エネテクニックを残しておきます。

まずExcelを開いて、リソース識別子の一覧をA列に貼り付けます。
次に、B列とC列を以下の固定値で埋めます。
B列とC列は、とりあえず1行目だけ書いて、あとは連続データでコピーします。

A列 B列 C列
リソース識別子 ※以下に記載の固定値 =SUBSTITUTE(B1, "{Service}", A1)

B列の固定値は以下の通り。

      {Service}:
      - type: exact
        property: tag:DoNotNuke
        value: "true"

イメージはこんな感じ。
これがA列のリソース識別子が途切れるまで並びます。
image.png

C列をコピーしてエディタに貼り付ければOK!
記事執筆時点でやってみた結果を、以下に添付しておきます。

"DoNotNuke"タグの値が"true"のリソースを残す
nuke_generic_config.yaml
regions:
  # add `global` here to include IAM entities to be nuked
  # nukeでリソースを削除する対象のリージョンをリストアップします
  - ap-northeast-1 
  - us-east-1

account-blocklist:
  - 123456789012 # 削除対象から外すアカウントをリストアップします

# optional: restrict nuking to these resources
resource-types:
  excludes: # 削除の対象外とするリソースをリストアップします
    - IAMUser
    - IAMUserPolicyAttachment
    - IAMUserAccessKey
    - IAMLoginProfile
    - IAMGroup
    - IAMRolePolicy
    - IAMRolePolicyAttachment
    - IAMPolicy
    - CloudTrailTrail

  targets: # 削除対象とするサービスをリストアップします
    - RDSInstance
    - EC2Instance
    - EC2Image
    - CloudFormationStack
    - LightsailInstance

accounts:
  ACCOUNT: # ACCOUNTという文字列はCodeBuild内で実際のアカウントIDに書き換えられます
    filters: # 特定のタグがついたリソースを削除対象外にできます
      ACMCertificate:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ACMPCACertificateAuthority:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ACMPCACertificateAuthorityState:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AMGWorkspace:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AMPWorkspace:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      APIGatewayAPIKey:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      APIGatewayClientCertificate:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      APIGatewayDomainName:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      APIGatewayRestAPI:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      APIGatewayUsagePlan:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      APIGatewayV2API:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      APIGatewayV2VpcLink:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      APIGatewayVpcLink:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AWS::AppFlow::ConnectorProfile:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AWS::AppFlow::Flow:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AWS::AppRunner::Service:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AWS::ApplicationInsights::Application:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AWS::Backup::Framework:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AWS::MWAA::Environment:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AWS::NetworkFirewall::Firewall:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AWS::NetworkFirewall::FirewallPolicy:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AWS::NetworkFirewall::RuleGroup:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AWS::Synthetics::Canary:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AWS::Timestream::Database:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AWS::Timestream::ScheduledQuery:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AWS::Timestream::Table:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AWS::Transfer::Workflow:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AWSBackupPlan:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AWSBackupRecoveryPoint:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AWSBackupSelection:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AWSBackupVault:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AWSBackupVaultAccessPolicy:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AccessAnalyzer:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AppMeshGatewayRoute:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AppMeshMesh:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AppMeshRoute:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AppMeshVirtualGateway:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AppMeshVirtualNode:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AppMeshVirtualRouter:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AppMeshVirtualService:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AppStreamDirectoryConfig:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AppStreamFleet:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AppStreamFleetState:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AppStreamImage:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AppStreamImageBuilder:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AppStreamImageBuilderWaiter:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AppStreamStack:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AppStreamStackFleetAttachment:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AppSyncGraphqlAPI:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ApplicationAutoScalingScalableTarget:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ArchiveRule:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AthenaNamedQuery:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AthenaWorkGroup:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AutoScalingGroup:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      AutoScalingPlansScalingPlan:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      BatchComputeEnvironment:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      BatchComputeEnvironmentState:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      BatchJobQueue:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      BatchJobQueueState:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      BillingCostandUsageReport:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      Budget:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      Cloud9Environment:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CloudDirectoryDirectory:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CloudDirectorySchema:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CloudFormationStack:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CloudFormationStackSet:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CloudFormationType:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CloudFrontDistribution:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CloudFrontDistributionDeployment:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CloudFrontOriginAccessIdentity:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CloudHSMV2Cluster:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CloudHSMV2ClusterHSM:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CloudSearchDomain:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CloudTrailTrail:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CloudWatchAlarm:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CloudWatchDashboard:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CloudWatchEventsBuses:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CloudWatchEventsRule:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CloudWatchEventsTarget:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CloudWatchLogsDestination:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CloudWatchLogsLogGroup:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CloudWatchLogsResourcePolicy:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CodeArtifactDomain:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CodeArtifactRepository:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CodeBuildProject:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CodeCommitRepository:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CodeDeployApplication:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CodePipelinePipeline:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CodeStarConnection:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CodeStarNotificationRule:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CodeStarProject:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CognitoIdentityPool:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CognitoIdentityProvider:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CognitoUserPool:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CognitoUserPoolClient:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      CognitoUserPoolDomain:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ComprehendDocumentClassifier:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ComprehendDominantLanguageDetectionJob:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ComprehendEndpoint:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ComprehendEntitiesDetectionJob:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ComprehendEntityRecognizer:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ComprehendKeyPhrasesDetectionJob:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ComprehendSentimentDetectionJob:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ConfigServiceConfigRule:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ConfigServiceConfigurationRecorder:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ConfigServiceDeliveryChannel:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      DAXCluster:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      DAXParameterGroup:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      DAXSubnetGroup:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      DataPipelinePipeline:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      DatabaseMigrationServiceCertificate:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      DatabaseMigrationServiceEndpoint:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      DatabaseMigrationServiceEventSubscription:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      DatabaseMigrationServiceReplicationInstance:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      DatabaseMigrationServiceReplicationTask:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      DatabaseMigrationServiceSubnetGroup:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      DeviceFarmProject:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      DirectoryServiceDirectory:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      DynamoDBTable:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      DynamoDBTableItem:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2Address:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2ClientVpnEndpoint:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2ClientVpnEndpointAttachment:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2CustomerGateway:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2DHCPOption:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2DefaultSecurityGroupRule:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2EgressOnlyInternetGateway:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2Host:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2Image:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2Instance:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      - property: LaunchTime
        type: dateOlderThan
        value: 1920h
      EC2InternetGateway:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2InternetGatewayAttachment:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2KeyPair:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2LaunchTemplate:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2NATGateway:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2NetworkACL:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2NetworkInterface:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2PlacementGroup:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2RouteTable:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2SecurityGroup:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2Snapshot:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2SpotFleetRequest:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2Subnet:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2TGW:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2TGWAttachment:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2VPC:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2VPCEndpoint:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2VPCEndpointConnection:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2VPCEndpointServiceConfiguration:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2VPCPeeringConnection:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2VPNConnection:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2VPNGateway:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2VPNGatewayAttachment:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EC2Volume:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ECRRepository:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ECSCluster:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ECSClusterInstance:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ECSService:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ECSTaskDefinition:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EFSFileSystem:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EFSMountTarget:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EKSCluster:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EKSFargateProfiles:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EKSNodegroups:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ELB:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ELBv2:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ELBv2TargetGroup:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EMRCluster:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      EMRSecurityConfiguration:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ESDomain:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ElasticBeanstalkApplication:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ElasticBeanstalkEnvironment:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ElasticTranscoderPipeline:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ElasticacheCacheCluster:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ElasticacheCacheParameterGroup:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ElasticacheReplicationGroup:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ElasticacheSubnetGroup:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      FMSNotificationChannel:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      FMSPolicy:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      FSxBackup:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      FSxFileSystem:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      FirehoseDeliveryStream:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      GlobalAccelerator:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      GlobalAcceleratorEndpointGroup:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      GlobalAcceleratorListener:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      GlueClassifier:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      GlueConnection:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      GlueCrawler:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      GlueDataBrewDatasets:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      GlueDataBrewJobs:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      GlueDataBrewProjects:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      GlueDataBrewRecipe:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      GlueDataBrewRulesets:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      GlueDataBrewSchedules:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      GlueDatabase:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      GlueDevEndpoint:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      GlueJob:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      GlueTrigger:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      GuardDutyDetector:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IAMGroup:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IAMGroupPolicy:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IAMGroupPolicyAttachment:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IAMInstanceProfile:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IAMInstanceProfileRole:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IAMLoginProfile:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IAMOpenIDConnectProvider:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IAMPolicy:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IAMRole:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IAMRolePolicy:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IAMRolePolicyAttachment:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IAMSAMLProvider:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IAMServerCertificate:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IAMServiceSpecificCredential:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IAMSigningCertificate:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IAMUser:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IAMUserAccessKey:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IAMUserGroupAttachment:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IAMUserPolicy:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IAMUserPolicyAttachment:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IAMUserSSHPublicKey:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IAMVirtualMFADevice:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ImageBuilderComponent:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ImageBuilderDistributionConfiguration:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ImageBuilderImage:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ImageBuilderInfrastructureConfiguration:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ImageBuilderPipeline:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ImageBuilderRecipe:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      Inspector2:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      InspectorAssessmentRun:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      InspectorAssessmentTarget:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      InspectorAssessmentTemplate:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IoTAuthorizer:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IoTCACertificate:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IoTCertificate:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IoTJob:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IoTOTAUpdate:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IoTPolicy:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IoTRoleAlias:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IoTStream:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IoTThing:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IoTThingGroup:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IoTThingType:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IoTThingTypeState:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      IoTTopicRule:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      KMSAlias:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      KMSKey:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      KendraIndex:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      KinesisAnalyticsApplication:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      KinesisStream:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      KinesisVideoProject:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      LambdaEventSourceMapping:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      LambdaFunction:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      LambdaLayer:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      LaunchConfiguration:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      LexBot:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      LexIntent:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      LexModelBuildingServiceBotAlias:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      LexSlotType:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      LifecycleHook:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      LightsailDisk:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      LightsailDomain:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      LightsailInstance:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      LightsailKeyPair:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      LightsailLoadBalancer:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      LightsailStaticIP:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      MQBroker:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      MSKCluster:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      MSKConfiguration:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      MachineLearningBranchPrediction:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      MachineLearningDataSource:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      MachineLearningEvaluation:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      MachineLearningMLModel:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      Macie:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      MediaConvertJobTemplate:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      MediaConvertPreset:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      MediaConvertQueue:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      MediaLiveChannel:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      MediaLiveInput:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      MediaLiveInputSecurityGroup:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      MediaPackageChannel:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      MediaPackageOriginEndpoint:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      MediaStoreContainer:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      MediaStoreDataItems:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      MediaTailorConfiguration:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      MobileProject:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      NeptuneCluster:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      NeptuneInstance:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      NetpuneSnapshot:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      OSDomain:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      OpsWorksApp:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      OpsWorksCMBackup:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      OpsWorksCMServer:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      OpsWorksCMServerState:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      OpsWorksInstance:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      OpsWorksLayer:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      OpsWorksUserProfile:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      QLDBLedger:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      RDSClusterSnapshot:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      RDSDBCluster:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      RDSDBClusterParameterGroup:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      RDSDBParameterGroup:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      RDSDBSubnetGroup:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      RDSEventSubscription:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      RDSInstance:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      RDSOptionGroup:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      RDSProxy:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      RDSSnapshot:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      RedshiftCluster:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      RedshiftParameterGroup:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      RedshiftSnapshot:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      RedshiftSubnetGroup:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      RekognitionCollection:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ResourceGroupGroup:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      RoboMakerRobotApplication:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      RoboMakerSimulationApplication:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      RoboMakerSimulationJob:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      Route53HealthCheck:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      Route53HostedZone:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      Route53ResolverEndpoint:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      Route53ResolverRule:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      Route53ResourceRecordSet:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      Route53TrafficPolicy:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      S3AccessPoint:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      S3Bucket:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      S3MultipartUpload:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      S3Object:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      SESConfigurationSet:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      SESIdentity:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      SESReceiptFilter:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      SESReceiptRuleSet:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      SESTemplate:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      SFNStateMachine:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      SNSEndpoint:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      SNSPlatformApplication:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      SNSSubscription:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      SNSTopic:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      SQSQueue:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      SSMActivation:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      SSMAssociation:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      SSMDocument:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      SSMMaintenanceWindow:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      SSMParameter:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      SSMPatchBaseline:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      SSMResourceDataSync:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      SageMakerApp:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      SageMakerDomain:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      SageMakerEndpoint:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      SageMakerEndpointConfig:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      SageMakerModel:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      SageMakerNotebookInstance:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      SageMakerNotebookInstanceLifecycleConfig:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      SageMakerNotebookInstanceState:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      SageMakerUserProfiles:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      SecretsManagerSecret:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      SecurityHub:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ServiceCatalogConstraintPortfolioAttachment:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ServiceCatalogPortfolio:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ServiceCatalogPortfolioProductAttachment:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ServiceCatalogPortfolioShareAttachment:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ServiceCatalogPrincipalPortfolioAttachment:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ServiceCatalogProduct:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ServiceCatalogProvisionedProduct:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ServiceCatalogTagOption:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ServiceCatalogTagOptionPortfolioAttachment:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ServiceDiscoveryInstance:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ServiceDiscoveryNamespace:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      ServiceDiscoveryService:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      SimpleDBDomain:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      StorageGatewayFileShare:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      StorageGatewayGateway:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      StorageGatewayTape:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      StorageGatewayVolume:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      TransferServer:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      TransferServerUser:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      WAFRegionalByteMatchSet:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      WAFRegionalByteMatchSetIP:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      WAFRegionalIPSet:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      WAFRegionalIPSetIP:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      WAFRegionalRateBasedRule:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      WAFRegionalRateBasedRulePredicate:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      WAFRegionalRegexMatchSet:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      WAFRegionalRegexMatchTuple:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      WAFRegionalRegexPatternSet:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      WAFRegionalRegexPatternString:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      WAFRegionalRule:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      WAFRegionalRuleGroup:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      WAFRegionalRulePredicate:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      WAFRegionalWebACL:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      WAFRegionalWebACLRuleAttachment:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      WAFRule:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      WAFWebACL:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      WAFWebACLRuleAttachment:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      WAFv2IPSet:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      WAFv2RegexPatternSet:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      WAFv2RuleGroup:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      WAFv2WebACL:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      WorkSpacesWorkspace:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      XRayGroup:
      - type: exact
        property: tag:DoNotNuke
        value: "true"
      XRaySamplingRule:
      - type: exact
        property: tag:DoNotNuke
        value: "true"

feature-flags:
  disable-deletion-protection:
    RDSInstance: true
    EC2Instance: true
    CloudformationStack: true
  force-delete-lightsail-addons: true

最後に

「リソース全削除ボタン」だけが独り歩きするのは怖すぎたので、実業務でまじめにaws-nukeを使うための記事も書こうと思い立ち、ガイド & Tips としてまとめました。
aws-nukeはリソース削除に非常に有用なツールです。
不要リソースの削除は、コスト削減に繋がり、さらに省エネにも繋がります。
この記事を参考にしていただき、適切にaws-nukeをご利用いただければ幸いです。

最後までお目通りいただき、ありがとうございました。

参考資料

1
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
1
0