This message was deleted.
# getting-started
s
This message was deleted.
l
That looks about right. To upload the file when creating the S3 bucket, use the BucketObject resource. To ensure that the EC2 instance has permission to copy from S3, you need to set up an IAM policy, role and instance profile.
And if you're not doing anything else in userdata, it's better not to use that. You can use a pulumi.Command: if it's dependent on both the EC2 instance and the BucketObject, then it will run any time either resource is recreated. This is particularly helpful if you want the most recent copy of the BucketObject to be on the EC2 instance at all times.
h
How to do that? I mean using Pulumi command?
l
You could use that, but I was thinking of pulumi.local.Command. Same package though.
Either-or. Command is more flexible. CopyFile relies on SSH, which might not be on the machine you're copying to.
You can use local.Command to run
aws cp
.
h
ok, thanks!