i understand that you are trying to figure out if it is possible to assign a name to a new instance during creation using user data script. Please correct me if i misunderstood you.
Unfortunately it is not possible to assign a new instance a name via user data script, however you can add tags to the instance using user data. Tags are metadata that can be used to categorize your AWS resources in different ways.
More information can be found on the listed AWS reference link .
I hope this helps.
how to find the sftp key file of my ec2 instanceasked 2 months ago
Amazon Connect instance creation via automated scriptsAccepted Answerasked 8 months ago
Use CLI to see "user data"?Accepted Answerasked 3 years ago
Elastic Beanstalk - EB_IS_COMMAND_LEADER during instance replacementAccepted Answerasked 6 months ago
Assign name-server to EC2 instance without using DHCP optionsAccepted Answerasked 7 years ago
[ElastiCache] How to figure out the required nodes and instance in ElastiCacheAccepted Answerasked 2 years ago
Can we create a Table in Aurora during the infra setup using terraform IaaC code ?Accepted Answerasked 5 months ago
naming instance during the instance creation using user dataAccepted Answerasked 3 months ago
CloudFormation stack template failing to receive 1 resource signal during creation of EC2 instanceasked 5 months ago
How to point a new instance with a domain?asked 5 months ago