-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Userdata not populated properly in CfnInstance #3419
Comments
I have a related issue, I am trying to embed the IP address of another ec2 instance in the user data of a second ec2 instance with (apologies for the typescript vs python):
This produces
This fails with a similar error due to lack of |
You should be able to wrap your user data in use const dbProxyInstance = new ec2.CfnInstance(this, "DBProxyInstance", {
instanceType: "t3a.small",
imageId: "ami-026c8acd92718196b",
securityGroupIds: [dbProxySecurityGroup.securityGroupId],
subnetId: vpc.publicSubnets[0].subnetId,
userData: cdk.Fn.base64(
`#!/bin/bash -xe
apt-get -y update
apt-get -y install xorg xfce4 autocutsel chromium-browser
add-apt-repository -y ppa:x2go/stable
apt-get -y install -y x2goserver x2goserver-xsession
apt-get -y install gnome-icon-theme tango-icon-theme`
)
}); |
@AlexCheema that worked, thanks! |
|
Hi, user_data= core.Fn.base64(shellCommands.render()) Full code example:
|
I'm submitting a ...
What is the current behavior?
I'm attempting to create EC2 instances with userdata to handle post-init configuration using the CfnInstance class. The userdata object is being created via the aws_ec2.UserData constructor.
The generated CloudFormation code fails with "Invalid BASE64 encoding of user data" error. The relevant YAML output looks like:
I would expect the generated UserData stanza to include the relevant Base64 encoding blocks. Something like:
What is the motivation / use case for changing the behavior or adding this feature?
Immediately, I want to create an EC2 instance with additional data volumes which are partitioned, formatted, and mounted when the instance is initialized. There are other post-init workflows that I would like to build later
Please tell us about your environment:
The text was updated successfully, but these errors were encountered: