I would like to create a Bash script that will start and stop specific resources in AWS. The problem I have is I would like to create a resource the requires the a specific resource ID that was created by the previous command. The goal is to be able to run a single script to start the resources instead of editing.
For example creating a NAT gateway then appending the ID of the NAT-gateway created to a route table command:
$ aws ec2 create-nat-gateway
Sample output:
"NatGatewayId": "nat-1111111"
$ aws ec2 replace-route --route-table-id rtb-000000000 \
--destination-cidr-block 0.0.0.0/0 --nat-gateway-id "***nat-id-output***"