This message was deleted.
# general
s
This message was deleted.
e
If so you can always just set the resource name explicitly
b
@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 <http://169.254.169.254/latest/dynamic/instance-identity/document> | jq .instanceId -r) --region eu-west-1 --query "Reservations[*].Instances[*].Tags[?Key=='aws:cloudformation:stack-name'].Value" --output text)
# aws region
REGION=$(curl -s <http://169.254.169.254/latest/dynamic/instance-identity/document> | jq .region -r)
# the name of the ASG this instance is in
ASG_NAME=$(aws ec2 describe-instances --instance-id $(curl -s <http://169.254.169.254/latest/dynamic/instance-identity/document> | jq .instanceId -r) --region eu-west-1 --query "Reservations[*].Instances[*].Tags[?Key=='aws:autoscaling:groupName'].Value" --output text)
c
@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
b
you'll need to make sure it has an IAM role that allows it to read those values of course
c
Sure 🙂