Upload a file from local machine to s3 bucket via cloudformation script

If I understand you correctly, you're asking if there's a way to upload a file to an S3 bucket via the CloudFormation stack that creates the bucket. Then answer is yes, but it is not simple or direct.

There are two ways to accomplish this.

1) Create an EC2 instance that uploads the file on startup. You probably don't want to start an EC2 instance and leave it running just to submit a single file, but it would work.

2) Use a Lambda-backed custom resource. See http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources.html for information about custom resources. In CloudFormation you could create the Lambda function itself, then create a custom resource based on that Lambda function. When the custom resource is created, the Lambda function would get called and you could use that function invocation to upload the file.

Note, that both approaches would also require creating an IAM role to grant the permissions required to perform the S3 upload.