A Bash script downloads S3 data to a temporary directory and transforms it.
Sensitive temporary files must be removed after success, failure, or interruption.
Which implementation is most appropriate?
Register cleanup with trap for EXIT and relevant signals, using a private working directory and safe path checks.
Detailed explanation
Object versioning does not remove files from a local temporary directory.
Object versioning does not remove files from a local temporary directory.
An early failure or interrupt leaves sensitive files behind.
An early failure or interrupt leaves sensitive files behind.
An audit record does not perform local file deletion.
An audit record does not perform local file deletion.
Cleanup runs across normal completion and common interruption paths instead of only after success.
Cleanup runs across normal completion and common interruption paths instead of only after success.
Check official documentation
Compare the following points with the official documentation.
Bash trap、EXIT、INT、作業ディレクトリの安全な削除を確認する。
What to confirm
正常終了だけの後処理と、終了経路を横断するcleanupの違いを説明できる。
Key points
- Bash trap
- Cleanup
- Temporary file
- Signal
Notes
- Environment: AWS公式DEA-C01試験ガイドと各サービスの公式ドキュメントの確認
- Confirm current AWS service behavior in the official DEA-C01 documentation.
Foundation review
Exit-path coverage
Review success, failure, termination, and signal paths to ensure cleanup always runs.
Safe deletion
Use a private directory, validated path, and appropriate permissions to avoid deleting unintended files.