This commit is contained in:
dzikafoczka 2024-12-20 21:08:10 +01:00
parent d6e036dea9
commit 2aa45a2d61

3
lb2.py
View File

@ -1,4 +1,5 @@
import boto3 import boto3
import base64
from USER_DATA import user_data from USER_DATA import user_data
# Configuration variables # Configuration variables
@ -169,7 +170,7 @@ def create_launch_template(ec2_client, key_name, security_group_id):
'InstanceType': INSTANCE_TYPE, 'InstanceType': INSTANCE_TYPE,
'SecurityGroupIds': [security_group_id], 'SecurityGroupIds': [security_group_id],
'KeyName': key_name, 'KeyName': key_name,
'UserData': user_data 'UserData': base64.b64encode(user_data.encode('utf-8')).decode('utf-8')
} }
) )