Skip to content

instance ec2 from s3 gave me an error #398

@CreativeMaladjustment

Description

@CreativeMaladjustment

❓ Guidance Question

The Question

After bringing the example code over and running a cdk diff/deploy or synth i get the error below. Which states that the AttributeError: '_UserDataProxy' object has no attribute 'add_s3_download_command', so i comment out those lines, 48 though 57 of app.py in instance/ec2. Things then run fine so i used instance.user_data.add_commands(f"yum update -y") for my user_data and it also worked and created an instance.

So the question is am i doing something wrong that is causing the s3 bucket user data to not work as it is in this repo, or has something changed such that this code should/could be updated? I do not see in this cdk anything creating an S3 bucket so wonder if these lines should do that and copy this configure.sh file to the bucket for the instance or if the local file is being treated as an s3 object somehow...

(thank you)

Environment

  • CDK CLI Version: 1.87.1 (build 9eeaa93)
  • Example: ec2/instance
  • Example Version:
  • OS: Amazon Linux 2 / cloud9 env
  • Language: Python

Other information

Traceback (most recent call last):
  File "app.py", line 61, in <module>
    EC2InstanceStack(app, "ec2-instance")
  File "/home/ec2-user/environment/cautious-guacamole/cdkworkshop/.env/lib64/python3.6/dist-packages/jsii/_runtime.py", line 83, in __call__
    inst = super().__call__(*args, **kwargs)
  File "app.py", line 49, in __init__
    local_path = instance.user_data.add_s3_download_command(
AttributeError: '_UserDataProxy' object has no attribute 'add_s3_download_command'
Subprocess exited with error 1```

Metadata

Metadata

Assignees

No one assigned

    Labels

    guidanceQuestion that needs advice or information.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions