Home > database >  Optional ways to put large UserData contents in CF template
Optional ways to put large UserData contents in CF template

Time:01-11

I have a CloudFormation template for deploying Cisco 8000v instances. In order to bootstrap these I have a very long device-specific user-data file. I can put the whole contents in the UserData block but then my CF template is not very reusable. Can I refer to the contents via a filename and import them somehow? Can't find any examples of this. What is a more common way to approach this? The UserData string as several instance-specific configurations. Should I base64 encode the string and refer to it as a parameter?

CodePudding user response:

You would store your long script externally to the instance, e.g. in S3. Then your user_data, would be very short, limited to downloading the script from S3 and executing it.

Alternatively, you can create custom ami which is per-configured for your use-case. This way your use_script can be reduce or even fully eliminated.

CodePudding user response:

You can not use user_data too much, so it is limited with 16KB. check it on here

Best way to do it. Store it on S3 or another place to your EC2 instance can reach. on user_data download and execute it.

  • Related