I'm trying to create EC2 instance with aws CDK and run some scripts to the newly deployed EC2 instance basically like this.
(Python would be better but cdk deploy seems to be run in shell anyway.)
cdk deploy && python script.py -I {new ec2 id} -s {new sg id}
But I need to get the instance id and security group id from cdk deploy result and use it as argument of next script, but not sure how can it be done.
Is it possible for cdk deploy to pass some values after deployment is done without very complex stdout from shell?
p.s: Other ways such as userdata and cloud-init which can be included in synth time doesn't work for me since it needs to get some other values as parameters from local scripts as well as some imperative procedures such as opening temporary port and close after script run.
question from:https://stackoverflow.com/questions/65929855/can-i-execute-another-script-with-values-created-from-cdk-deploy