troubleshooting Question

AWS & PoweShell - How do I go through a text file from within a script

Avatar of FikreDeneke
FikreDenekeFlag for United States of America asked on
PowershellAWS
7 Comments1 Solution175 ViewsLast Modified:
How can I run Script 2 by it's self? Script 1 is a cmd file, but what do I need to delclare in Script 2 to make it a valid script?

Script 1 pulls out all the snapshots (their ID) for a volume to a text file (snaps.txt)
aws ec2 describe-snapshots --filters Name=volume-id,Values=vol-123456 --query Snapshots[*].{ID:SnapshotId} --output text >c:\temp\snaps.txt

Script 2 should go through the text file snaps.txt and tag all the snapshots.
for /F %i in (c:\temp\snaps.txt) do aws ec2 create-tags --resources %i --tags Key=Environment,Value=ABC123


I ran the file snapscript01.cmd to create the list of snapshots in a text file which worked. Awesome. What type of file do I need to run through that output file snaps.txt so it can loop it? I created a cmd and bat with just the command text and it didn't work. No error. I don't want to touch the existing backup script. I want a new script.
ASKER CERTIFIED SOLUTION
Shalom Carmel
CTO

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros