User Tools

Site Tools


aws:aws-cli

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
aws:aws-cli [10/02/2025 11:32] – [Get repos] andrewaws:aws-cli [17/04/2025 11:26] (current) – [Explanation of "StandardsArn": "'"${STANDARD}"'"] andrew
Line 551: Line 551:
  
 </code> </code>
 +
 +
 +===== Embedding a BASH variable in JSON =====
 +
 +<code bash>
 +STANDARD='arn:aws:securityhub:::ruleset/nist-800-53/v/5.0.0'
 +
 +aws securityhub  batch-update-standards-control-associations \
 +    --standards-control-association-updates \
 +    --profile OrgDeployRole \
 +    '[
 +    {
 +    "SecurityControlId": "IAM.9",
 +    "StandardsArn": "'"${STANDARD}"'",
 +    "AssociationStatus": "DISABLED",
 +    "UpdatedReason": "Not applicable to environment"
 +    }
 +    ]'
 +
 +
 +</code>
 +
 +==== Explanation of "StandardsArn": "'"${STANDARD}"'" ====
 +
 +JSON keys and values need to be quoted, so that's the outside double quotes, STANDARD cannot be expnded by the aws command so it is single quoted, but lastly as BASH sees it, it is double quoted so BASH can expand the variable "${var}" to the value it represents.
 +
 +I think.... Not 100% sure on the single quotes usage
 +
 +
 +
  
  
  
aws/aws-cli.1739187147.txt.gz · Last modified: by andrew

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki