Git Product home page Git Product logo

Comments (5)

simonw avatar simonw commented on July 19, 2024

Logging messages go to stderr, so even though they are displayed by default if the user does this it will work as expected:

% s3-credentials create hello-simon-world-bucket-2 --format ini --create-bucket > ini.txt
Created user: s3.read-write.hello-simon-world-bucket-2 with permissions boundary: arn:aws:iam::aws:policy/AmazonS3FullAccess
Attached policy s3.read-write.hello-simon-world-bucket-2 to user s3.read-write.hello-simon-world-bucket-2
Created access key for user: s3.read-write.hello-simon-world-bucket-2
% cat ini.txt 
aws_access_key_id=AKIAWXFXAIOZADC3B4RA
aws_secret_access_key=acdecuec/lfz56oo4jE2+glHJIAeKmhS3zgXUF2Nc9

from s3-credentials.

simonw avatar simonw commented on July 19, 2024

With ini in there I don't actually need the one that outputs shell environment variable syntax, because the ini format works for that already.

% source ini.txt 
% echo $aws_access_key_id
AKIAWXFXAIOZKGXI4PVO

from s3-credentials.

simonw avatar simonw commented on July 19, 2024
% cat ini.txt 
aws_access_key_id=AKIAWXFXAIOZADC3B4RA
aws_secret_access_key=acdecuec/lfz56oo4jE2+glHJIAeKmhS3zgXUF2Nc9

It turns out this isn't actually a valid INI file - in as much as Python's configparser standard library module refuses to handle it because it's missing the header:

>>> p = configparser.ConfigParser()
>>> p.read("ini.txt")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/simon/.pyenv/versions/3.10.0/lib/python3.10/configparser.py", line 698, in read
    self._read(fp, filename)
  File "/Users/simon/.pyenv/versions/3.10.0/lib/python3.10/configparser.py", line 1086, in _read
    raise MissingSectionHeaderError(fpname, lineno, line)
configparser.MissingSectionHeaderError: File contains no section headers.
file: 'ini.txt', line: 1
'aws_access_key_id=AKIAWXFXAIOZKGXI4PVO\n'

from s3-credentials.

simonw avatar simonw commented on July 19, 2024

On https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html#cli-configure-files-where the example uses a [default] section header in ~/.aws/credentials:

[default]
aws_access_key_id=AKIAIOSFODNN7EXAMPLE
aws_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

This would break the source ini.txt trick from #17 (comment) so I maybe do need a --format env option for outputting environment variables.

from s3-credentials.

simonw avatar simonw commented on July 19, 2024

I forgot to add --format ini support to --duration in #27.

from s3-credentials.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.