2

Im creating a SSM document with a state machine, in the api parameter: Name.

I want to combine a value from the state’s input (InstanceID) with the hard-coded text EC2-PROD-WEBSRV-CP_RAM_SWAP-Document.

Im wondering if something like "key2.$": "$.inputValue[+hardcodedstring]" is possible.

So the final value will be i-013165f64447e25e0-EC2-PROD-WEBSRV-CP_RAM_SWAP-Document.

SSM CreateDocument schema:

{
   "Attachments": [ 
      { 
         "Key": "string",
         "Name": "string",
         "Values": [ "string" ]
      }
   ],
   "Content": "string",
   "DisplayName": "string",
   "DocumentFormat": "string",
   "DocumentType": "string",
   "Name": "string",
   "Requires": [ 
      { 
         "Name": "string",
         "Version": "string"
      }
   ],
   "Tags": [ 
      { 
         "Key": "string",
         "Value": "string"
      }
   ],
   "TargetType": "string",
   "VersionName": "string"
}

I read the documentation but It seems it is possible just one or the other option.

https://aws.amazon.com/blogs/compute/using-jsonpath-effectively-in-aws-step-functions/

1 Answer 1

1

Use the States.Format intrinsic function to interpolate the value into a string:

"key2.$": "States.Format('{}-EC2-PROD-WEBSRV-CP_RAM_SWAP-Document', $.inputValue)"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.