amazon.aws icon indicating copy to clipboard operation
amazon.aws copied to clipboard

AWS S3 put object using only body

Open zoudawen opened this issue 4 years ago • 4 comments

SUMMARY

in AWS boto3 for python I am able to directly write a string to S3 as a file, I went through the code and documentation and didnt see that as a feature in this ansible collection. Are there any work arounds currently, if not is this on the road map?

ISSUE TYPE
  • Feature Idea
COMPONENT NAME
  • ansible-collections/amazon.aws
ADDITIONAL INFORMATION

in python - boto3 S3.put_object(Bucket='mys3bucket', Key='dest/file/location.txt', Body=data_string)

this would be useful for writing a lot of small files to S3 rather than copy files from local machine or local storage to s3 bucket, this is useful for data ETLs

zoudawen avatar Apr 20 '21 22:04 zoudawen

Files identified in the description: None

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot avatar Apr 20 '21 22:04 ansibullbot

@DzouOnionGardener: Greetings! Thanks for taking the time to open this issue. In order for the community to handle your issue effectively, we need a bit more information.

Here are the items we could not find in your description:

  • component name

Please set the description of this issue with this template: https://raw.githubusercontent.com/ansible/ansible/devel/.github/ISSUE_TEMPLATE/bug_report.md

click here for bot help

ansibullbot avatar Apr 20 '21 22:04 ansibullbot

Hi @DzouOnionGardener, thank you for raising this issue. Could you please try using this? content parameter allows you to specify the content to put in a file. Let me know please if this solved your problem.

      - name: create an object from static content
        aws_s3:
          bucket: bucket_name
          object: file.txt
          mode: put
          content: >-
            simple content string
        register: result

alinabuzachis avatar May 05 '21 17:05 alinabuzachis

@DzouOnionGardener This issue is waiting for your response. Please respond or the issue will be closed.

click here for bot help

ansibullbot avatar Jul 01 '21 10:07 ansibullbot

s3_object's "content" parameter provides this functionality.

tremble avatar Feb 06 '23 09:02 tremble