1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Amazon Web Services (AWS)

Discussion in 'Support' started by bwawsc2, Jan 21, 2011.

  1. bwawsc2

    Joined:
    Jun 16, 2008
    Messages:
    9
    Likes Received:
    0
    I've been trying to use the command line interface to AWS supplied by Amazon, with little success. It is provided as a library of .cmd files (and other files used by the .cmd scripts). These scripts almost universally produce error messages with TakeCommand (and TCC) but work fine with the standard Windows command processor. I assume there's a level of SETDOS that will make them work, but I haven't had time to work through the testing required.

    Has anyone here had some experience with this service and how to make it work under TakeCommand?
     
  2. drrob106

    Joined:
    Jan 24, 2009
    Messages:
    36
    Likes Received:
    0
    I don't have direct experience but under options tcc look for the check box that's labeled Duplicate cmd bugs.

    Sent from my Droid Incredible Verizon Wireless phone

    ----- Reply message -----
    From: "bwawsc2" <>
    Date: Fri, Jan 21, 2011 11:29 am
    Subject: [Support-t-2544] Amazon Web Services (AWS)
    To: <rob@drrob1.com>

    I've been trying to use the command line interface to AWS supplied by Amazon, with little success. It is provided as a library of .cmd files (and other files used by the .cmd scripts). These scripts almost universally produce error messages with TakeCommand (and TCC) but work fine with the standard Windows command processor. I assume there's a level of SETDOS that will make them work, but I haven't had time to work through the testing required.

    Has anyone here had some experience with this service and how to make it work under TakeCommand?
     
  3. samintz

    samintz Scott Mintz

    Joined:
    May 20, 2008
    Messages:
    1,189
    Likes Received:
    11
    I went to the http://aws.amazon.com
    web site and was quickly overwhelmed with choices. What do I need
    to download to replicate your issue?

    -Scott

    bwawsc2 <> wrote on 01/21/2011
    11:29:25 AM:



    of .cmd


    assume


     
  4. bwawsc2

    Joined:
    Jun 16, 2008
    Messages:
    9
    Likes Received:
    0
    Boy, that's ambitious. :) Here's the "Getting Started Guide" for an example cli:

    http://awsdocs.s3.amazonaws.com/IAM/latest/iam-gsg.pdf

    It calls for downloading this zip file:

    http://aws.amazon.com/developertools/AWS-Identity-and-Access-Management/4143

    You can't do anything useful with it unless you have an Amazon account and have applied for access to their Web Services, but you can probably at least reproduce the error messages.
     
  5. bwawsc2

    Joined:
    Jun 16, 2008
    Messages:
    9
    Likes Received:
    0
    Just for the record, this didn't do it.

    Here's an example of a statement within one of the .cmd files that causes an error in TakeCommand but not in CMD.exe:

    </rob@drrob1.com>
     
  6. samintz

    samintz Scott Mintz

    Joined:
    May 20, 2008
    Messages:
    1,189
    Likes Received:
    11
    I downloaded the ZIP file and looked at iam-cmd.cmd.

    The file uses the CMD syntax for string substitution: %variable:str1=str2%

    That syntax replaces all occurrences of str1 with str2 within variable.
    The specific syntax in the iam-cmd.cmd file is:

    if "%CHK_AWS_IAM_HOME:"=%" == "_" goto AWS_IAM_HOME_MISSING
    if "%CHK_JAVA_HOME:"=%" == "_" goto JAVA_HOME_MISSING
    ...
    "%JAVA_HOME:"=%\bin\java" %AWS_IAM_JVM_OPTS% -classpath "%CP%"
    com.amazonaws.services.auth.identity.cli.view.%CMD% %ARGV%

    Since str2 is allowed to be empty, that effectively means remove all
    occurrences of str1, or in the above examples, remove the double quotes.
    When I run the above file, I get errors on those two IF statements when
    run from TCC.

    C:\Temp\wzd7b7\IAMCli-1.1.0\bin\iam-cmd.cmd [19] Usage : IF [/I] [NOT]
    condition [.AND. | .OR. | .XOR. [NOT] condition ...] command
    C:\Temp\wzd7b7\IAMCli-1.1.0\bin\iam-cmd.cmd [20] Usage : IF [/I] [NOT]
    condition [.AND. | .OR. | .XOR. [NOT] condition ...] command

    Turning on DuplicateBugs makes no difference.

    -Scott

    bwawsc2 <> wrote on 01/21/2011 03:26:24 PM:


    example cli:

    http://aws.amazon.com/developertools/AWS-Identity-and-Access-Management/4143


     
  7. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,856
    Likes Received:
    83
    There's a LOT of problems in those scripts -- starting with Amazon apparently not knowing that Windows uses CR/LF for EOLs, and continuing to the illegal / undocumented syntax they're using for variable substitution.

    Some of this I may be able to hack around; I'll poke into it a bit.
     
  8. samintz

    samintz Scott Mintz

    Joined:
    May 20, 2008
    Messages:
    1,189
    Likes Received:
    11
    According to CMD /C SET /? the syntax is documented. Which part of the
    syntax is illegal/undocumented?

    Environment variable substitution has been enhanced as follows:

    %PATH:str1=str2%

    would expand the PATH environment variable, substituting each occurrence
    of "str1" in the expanded result with "str2". "str2" can be the empty
    string to effectively delete all occurrences of "str1" from the expanded
    output. "str1" can begin with an asterisk, in which case it will match
    everything from the beginning of the expanded output to the first
    occurrence of the remaining portion of str1.

    May also specify substrings for an expansion.

    %PATH:~10,5%

    would expand the PATH environment variable, and then use only the 5
    characters that begin at the 11th (offset 10) character of the expanded
    result. If the length is not specified, then it defaults to the
    remainder of the variable value. If either number (offset or length) is
    negative, then the number used is the length of the environment variable
    value added to the offset or length specified.

    %PATH:~-10%

    would extract the last 10 characters of the PATH variable.

    %PATH:~0,-2%

    would extract all but the last 2 characters of the PATH variable.

    -Scott

    rconn <> wrote on 01/21/2011 04:36:57 PM:


     
  9. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,304
    Likes Received:
    39
    Undocumented for TCC, I think he means.
     
  10. bwawsc2

    Joined:
    Jun 16, 2008
    Messages:
    9
    Likes Received:
    0
    This agrees with my observation and with their stated intention (from some notes somewhere that I can't find anymore) to strip quotes from variables. Why they don't use CR/LF <cr><lf> in native Windows files I don't know. I see this a lot from people who are basically Unix users porting their stuff to Windows. Windows seems to handle it ok, but it makes most files unreadable by humans.</lf></cr>
     
  11. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,856
    Likes Received:
    83
    Embedding a double quote as a variable name character.

    They can get away with this in CMD because it requires a leading and trailing %, and assumes that everything between them must be a valid character (including spaces, tabs, quotes, etc.). There's no way to allow this in TCC without requiring everybody to change their aliases & batch files from a single leading % to always use the CMD variable name syntax.
     
  12. Steve Pitts

    Joined:
    Jul 7, 2008
    Messages:
    159
    Likes Received:
    0
    Forgive me for stating the bleeding obvious, but why not let CMD.EXE execute those scripts then?? Personally I've always set up 4DOS/4OS2/4NT/Take Command et al so that they execute .BTM files whilst .CMD and .BAT files are left for the OS to handle in the usual way. Whilst there may be benefits to having TC execute everything, in general the various compatability issues make that more trouble than its worth.
     
  13. bwawsc2

    Joined:
    Jun 16, 2008
    Messages:
    9
    Likes Received:
    0
    Primarily because I hate the limitations of cmd.exe and don't like working within it. The other answer is that I'm a beta tester at heart and can't help raising compatibility issues whenever I encounter them. And this sounds like an oversight on Rex's part - he overlooked a feature of the command syntax in cmd.exe and I'm sure he will want to fix it - even if not as a high priority.
     
  14. Steve Pitts

    Joined:
    Jul 7, 2008
    Messages:
    159
    Likes Received:
    0
    Fair enough, and I'm not suggesting that you ever work within it (I try to avoid that too) just let it execute scripts designed to run under it.

    I'm not sure that that is entirely true but I'd certainly like to disagree with the sentiment. There has been a long-time dichotomy between those of us that would prefer Rex's product to stay true to its own roots and only support CMD's way of doing things if they don't break the consistency of the existing product and those that would prefer CMD compatability at all costs. I fall into the former group, since I've been using them pretty much as long as I've been using the operating systems on which they run/ran (dating back to the mid 90s) and have always avoided the built-in command line processors.
     
  15. samintz

    samintz Scott Mintz

    Joined:
    May 20, 2008
    Messages:
    1,189
    Likes Received:
    11
    The other thing to keep in mind is that
    while you may have associated .BAT and .CMD with CMD.EXE, if you execute
    one of those scripts from a TCC prompt, then TCC will execute them and
    not CMD. Only if you launch those scripts from Explorer or some other
    non-TCC process will CMD execute them.

    And if those scripts modify the environment,
    like vcvars32.bat for example, then executing them in a separate process
    loses all those mods. So there is definitely a use case for wanting
    those scripts to run correctly in a TCC process.

    I experimented a little a while ago
    with PATHEXT and created a wrapper for executing BAT files in CMD within
    TCC. I'll see if I can find what I did with it. It may even
    be in this forum somewhere.

    -Scott

    bwawsc2 <> wrote on 01/25/2011
    05:44:09 PM:




    worth.

     

Share This Page