I am trying to create multiple users using the AWS CLI. This is just an exercise in learning.
I get different errors depending on what changes I make. After a bit of searching, I changed the encoding and used file:// which elimated the Invalid JSON received errors.
I've tried this with a json file that is ASCII encoded and only one user.
aws iam create-user --cli-input-json file://aws-ec2.json --profile MyProf
I get:
Parameter validation failed: Invalid length for parameter Path, value:
0, valid range: 1-inf Invalid length for parameter
PermissionsBoundary, value: 0, valid range: 20-inf Invalid length for
parameter Tags[0].Key, value: 0, valid range: 1-inf
If I add another user, so change the UserName line to "MyEC2","SecondEC2", it just gives me Invalid JSON received.
Here's the JSON I am using:
{
"Path": "",
"UserName": "MyEC2",
"PermissionsBoundary": "",
"Tags": [
{
"Key": "",
"Value": ""
}
]
}
I know I'm doing something wrong, I just can't figure out what it is!
Thank you John. No one had anything to add. A friend of mine, networking person, suggested that I copy the command into Excel, concatenate the columns and then copy and paste the commands into the CLI.
I was hoping for a different response, but as I wrote in my question, this was just an exercise in learning. Your answer is an answer, and apparently a correct answer.
Thanks again for your time.
Related
I am working on a Power Automate flow to get a JSON file from SharePoint and Parse it. On one of my previous questions I received a solution that worked with a testing JSON file. However when I ran a couple of tests with some JSON files that I need to use, the Parse JSON step gives out errors regarding "missing" required properties.
Basically, the JSON file's arrays do not always have exactly the same elements (properties). For example (below) the element "minimun_version" does not always appear under the element "link", like the image below
and because of this syntax I get the errors below
How can I Parse such a JSON file successfully?
Any idea or suggestion will help me get unstuck.
Thank you
You can allow null values in your Parse Json schema by simply adding that to the schema. April Dunnam has a nice article about this approach:
https://www.sharepointsiren.com/2018/10/flow-parse-json-null-error-fix/
I assume you have something like below in your schema?
"minimum_version": {
"type": "number"
}
You can change that to this to allow null values
"minimum_version": {
"type": [
"number",
"null"
]
}
I was tasked to filter through data using the elasticsearch-kibana stack. My data comes in JSON format like so,
{
"instagram_account": "christywood",
"full_name": "Christy Wood",
"bio": "Dog mom from Houston",
"followers_count": 1000,
"post_count": 1000,
"email": christy#gmail.com,
"updated_at": "2022-07-18 02:06:29.998639"
}
However, when I try to import the data into Kibana, I get an error that states my data does not match the default GROK pattern.
I tried writing my own GROK, using the list of acceptable syntaxes in this repo, but the debugger always parses the key rather than the actual desired value. For instance, the GROK pattern
%{USERNAME:instagram_account}
returns this undesired data structure
{
"instagram_account": "instagram_account"
}
I've tried a couple other syntax options, but it seems that my debugger always grabs the key and not the actual value. No wonder elastic search cannot make sense of my data!
I've searched for examples, but I am unable to find any that use JSON data. To be fair, I'm very unfamiliar with GROK and would like to understand what % , /n , and other delimiters mean within this context.
Please tell me what I'm doing wrong, and point me in the right direction. Thank you!
This is response of the Login request that i need to extract data from.
As you can see first line is not JSON format and Insomnia is complaining about it as "Invalid JSON: Unexpected token ) in JSON at position 0"
Is there any way to ignore/remove first line then extract data? May be custom query?
)]}',
{
"userid": "USER1",
"email": "user1#email.com",
"name": "John Jones"
}
If this is a one-off, just delete the first line with a text editor.
If it's happening systematically, then (a) you really ought to get it fixed at source rather than repairing it after the event, and (b) you need to know what the general pattern of bad data is, rather than working from one example.
I am receiveing data from AWS IoT and the incomming data looks like:
{
"desired": {
"status": "ON",
"Temperature": 4,
},
"reported": {
"status": "ON",
"Temperature": 4
}
}
I have set up a text message alert every time that new data comes in. With the text message I only want to receive the temperature. The current query string is:
SELECT * FROM '$aws/things/MyDashButton/shadow/update'
I am assuming that I have to change the star to Temperature, but when I do the text message I receive is blank. I tried looking through the documentation, but cannot find an answer for this.
EDIT:
If I use
SELECT state.desired.Temperature FROM '$aws/things/MyDashButton/shadow/update'
I get {"Temperature": 4} is there a way just to get the value?
There is no way to just get a value by using only the AWS IoT rule engine.
You can instead write some code in AWS Lambda to send you just the value (or with other cosmetics you desire) via AWS SES. Use the Rule Engine to invoke the Lambda function.
I would like to know if the following message is well parsed according to json format, I think it is but the application that needs to process it complains about it with the following error
[ERR]tx data JSON file error
The code in the file is this one
{"tx":
{
"moteeui":"fa789f0000000000",
"txmsgid":"000000000152",
"trycount":"5",
"txsynch" : "false",
"ackreq" : "true",
"userdata":
{
"port":"10",
"payload":"ABCABC"
}
}
}
Thanks in advance,
regards!
I have tried also the following snippet
[{
"mote": "202020",
"payload": "ABCB",
"port": 2,
"trycount": 5,
"txmsgid": ""
}]
I have validated with JSONLint and I get an error saying
[ERR]tx data JSON parsing error: 3 object item(s) left unpacked
Does it ring a bell?
Thanks again
Yes, it is correct.
For your info, JSONLint is a good site for checking the validity of JSON.
However, you may want to rethink setting numeric values as strings. ie, it is a better idea to say:
"trycount":5
rather than
"trycount":"5"
As the former indicates to whatever application is consuming the JSON that the value should be parsed as a number.
Similarly with the boolean values, it's better practise to use:
"txsynch" : false
rather than
"txsynch" : "false"
It won't cause an error in your JSON parser to pass these as strings, it is just better practise.
The error in the parser could be for many different reasons.