fix: resolve EC2 CREATE_FAILED by moving UserData to cfn-init metadata#56
Open
gutomo wants to merge 1 commit intoaws-samples:mainfrom
Open
fix: resolve EC2 CREATE_FAILED by moving UserData to cfn-init metadata#56gutomo wants to merge 1 commit intoaws-samples:mainfrom
gutomo wants to merge 1 commit intoaws-samples:mainfrom
Conversation
…limit (CREATE_FAILED)
Contributor
|
Hi @gutomo, thanks for this contribution! The cfn-init architecture is exactly the right approach — clean solution and well-structured PR. Since you opened this PR, we've landed a few changes on main that overlap with what you're addressing:
Could you rebase your branch on the latest main and update the PR? Your cfn-init restructuring is the valuable part here and we'd love to get it merged. Happy to help if you run into any conflicts. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Deploying the CloudFormation stack fails with:
The inline
UserDatabash script is ~20KB raw. AfterFn::Subvariableexpansion and base64 encoding, it exceeds EC2's hard 16,384-byte limit.
Solution
Move the bulk setup logic from inline
UserDataintoAWS::CloudFormation::Initmetadata, which is fetched via theCloudFormation API at runtime and has no size limit.
What changed
cfn-bootstrapand runscfn-initwrite_filesstages config files to/opt/openclaw/:setup.sh— the full setup script (formerly inline in UserData)openclaw-config.json— Bedrock config templateSOUL.md— first-message onboarding promptssm-portforward.sh— SSM access helperrun_setupexecutes/opt/openclaw/setup.shthe SSM helper script:
ec2:DescribeTagscloudformation:DescribeStackResourcecloudformation:SignalResourceNo behavioral changes
The setup flow, installed software, config files, and outputs are
identical. Only the delivery mechanism changed (inline UserData →
cfn-init metadata).
Testing
cfn-lintpasses (only pre-existing W8001 warning for unusedEnableDockercondition)