```const filesBucket = new aws.s3.Bucket('filesBuc...
# getting-started
m
Copy code
const filesBucket = new aws.s3.Bucket('filesBucket')

const createNewFile = () => {
    new aws.s3.BucketObject(
        'foo.txt', 
        {
            bucket: filesBucket,
            content: ''
        }
    )
}

const createNewFileSchedule: aws.cloudwatch.EventRuleEventSubscription = aws.cloudwatch.onSchedule(
    "createNewFile",
    "rate(2 minutes)",
    createNewFile
);
Is there something I’m doing wrong with the
createNewFile
function? I’m not seeing new files show up in the Bucket on AWS
b
This isn't going to work, when you pass a function like that with pulumi the function is serialized so that it can be passed to the resource. Then that function is executed later with a different process, in a different context. So it no longer occurs during your pulumi up invocation, and pulumi is not available when it is executed, nor is your stack or any other state information about that deployment. The deployment has finished at that point.
👍 1