Hi all, I have an issue with the AutoScalingGroup...
# general
Hi all, I have an issue with the AutoScalingGroup AWS. I need to specify my own userData in the launch configuration. Yet I am unable to remove the suffix from and therefore predict the stack name. As a result I can do whatever i want in my user data but can never send the signal to cloudformation and my stack creation always fail Any pointer on how to get out of this?
If so you can always just set the resource name explicitly
@cuddly-alligator-37434 you can retrieve the ASG from within the user data:
Copy code
# cloudformation stack name
STACK_NAME=$(aws ec2 describe-instances --instance-id $(curl -s <> | jq .instanceId -r) --region eu-west-1 --query "Reservations[*].Instances[*].Tags[?Key=='aws:cloudformation:stack-name'].Value" --output text)
# aws region
REGION=$(curl -s <> | jq .region -r)
# the name of the ASG this instance is in
ASG_NAME=$(aws ec2 describe-instances --instance-id $(curl -s <> | jq .instanceId -r) --region eu-west-1 --query "Reservations[*].Instances[*].Tags[?Key=='aws:autoscaling:groupName'].Value" --output text)
@echoing-dinner-19531 thank you! as far as I could see, there is no option to do that on the autoscaling group (not on cluster.addAutoscalingGroup and cluster.createAutoScalingGroup)
@billowy-army-68599 I think that will work!! thank you
you'll need to make sure it has an IAM role that allows it to read those values of course
Sure 🙂