Friday, June 26, 2020

AWS Security Mcq

test react

Saturday, June 6, 2020

AWS Developer Certification Questions




Score 0 😑
EBS falls under which category ?
IaaS
PassS
SaaS
None
Info

Saturday, May 16, 2020

AWS EBS Quiz




Score 0 😑
AWS EBS : Elastic Block Storage
EBS falls under which category ?
IaaS
PassS
SaaS
None
Info

Saturday, May 2, 2020

InvalidParameterType: Expected params.MessageBody to be a string



Error Blog 

This blog is about the error InvalidParameterType: Expected params.MessageBody to be a string.

Problem Statement

unable to post data to AWS SQS  using AWS Node.js SDK .

Error Details 

error Log

ERROR DETAILS 


{ InvalidParameterType: Expected params.MessageBody to be a string
    at ParamValidator.fail (F:\progvocab\repo\orders\node_modules\aws-sdk\lib\param_validator.js:50:37)
    at ParamValidator.validateType (F:\progvocab\repo\orders\node_modules\aws-sdk\lib\param_validator.js:232:10)
    at ParamValidator.validateString (F:\progvocab\repo\orders\node_modules\aws-sdk\lib\param_validator.js:154:32)
    at ParamValidator.validateScalar (F:\progvocab\repo\orders\node_modules\aws-sdk\lib\param_validator.js:130:21)
    at ParamValidator.validateMember (F:\progvocab\repo\orders\node_modules\aws-sdk\lib\param_validator.js:94:21)
    at ParamValidator.validateStructure (F:\progvocab\repo\orders\node_modules\aws-sdk\lib\param_validator.js:75:14)
    at ParamValidator.validateMember (F:\progvocab\repo\orders\node_modules\aws-sdk\lib\param_validator.js:88:21)
    at ParamValidator.validate (F:\progvocab\repo\orders\node_modules\aws-sdk\lib\param_validator.js:34:10)
    at Request.VALIDATE_PARAMETERS (F:\progvocab\repo\orders\node_modules\aws-sdk\lib\event_listeners.js:126:42)
    at Request.callListeners (F:\progvocab\repo\orders\node_modules\aws-sdk\lib\sequential_executor.js:106:20)
  message: 'Expected params.MessageBody to be a string',
  code: 'InvalidParameterType',
  time: 2020-05-02T19:25:34.438Z }
null





Error Code 

This error is due to the datatype of message is something other than string .




const aws = require('aws-sdk');
const config = require('./config.json');


(async function(){
try{
aws.config.setPromisesDependency();
aws.config.update( {
accessKeyId : config.accessKeyId,
secretAccessKey : config.secretAccessKey,
region :"us-east-2"
}
);
let sqs = new aws.SQS();
let msg = {"orderId":1 , "item":"Laptop","quantity":10};
let details = {
MessageBody : msg ,
QueueUrl : "https://sqs.us-east-2.amazonaws.com/320524107631/orders"
};
sqs.sendMessage(
details , function(err , data ){
console.log(err);
console.log(data);
}
);
}catch(e){
console.log(e);
}
}
)();


  

Solution

change the datatype of message and make it as a string .

Code Changes 

Since the message was in JSON format , I have converted it to String .

  
        
const aws = require('aws-sdk');
const config = require('./config.json');


(async function(){
try{
aws.config.setPromisesDependency();
aws.config.update( {
accessKeyId : config.accessKeyId,
secretAccessKey : config.secretAccessKey,
region :"us-east-2"
}
);
let sqs = new aws.SQS();
let msg = {"orderId":1 , "item":"Laptop","quantity":10};
let details = {
MessageBody : JSON.stringify(msg) ,
QueueUrl : "https://sqs.us-east-2.amazonaws.com/320524107631/orders"
};
sqs.sendMessage(
details , function(err , data ){
console.log(err);
console.log(data);
}
);
}catch(e){
console.log(e);
}
}
)();
         

OUTPUT
null
{ ResponseMetadata: { RequestId: 'dc26fa07-6d82-599e-ad56-ad20a13a2cde' },
  MD5OfMessageBody: 'bc33fad3d612e7283260076cc3a47167',
  MessageId: '97312d2d-afe4-4184-9931-32fda4ef8178' }


Thanks for reading . Let me know your thoughts in the comments below    .

An error occurred (InvalidSignatureException) when calling the DescribeTable operation: Signature not yet current



Error Blog 

This blog is about the error An error occurred (InvalidSignatureException) when calling the DescribeTable operation: Signature not yet current .

Problem Statement

unable to fetch data from AWS DynamoDB table using AWS CLI .

Error Details 

error Log

ERROR DETAILS 


An error occurred (InvalidSignatureException) when calling the DescribeTable operation: Signature not yet current: 20200502T150446Z is still later than 20200502T143607Z (20200502T142107Z + 15 min.)




Error Code 

This error is due to a mismatch between the PC time and AWS time .




time
The current time is: 22:42:13.41


  

Solution

change the system time so that it matches with the AWS time .

Code Changes 

add the following import in your component.ts file .

  
        
   time
The current time is: 22:42:13.41
Enter the new time: 22:42:10
         

OUTPUT
aws dynamodb describe-table --table-name AWS_LOG
{
    "Table": {
        "AttributeDefinitions": [
            {
                "AttributeName": "LOG_ID",
                "AttributeType": "S"
            }
        ],
        "TableName": "AWS_LOG",
        "KeySchema": [
            {
                "AttributeName": "LOG_ID",
                "KeyType": "HASH"
            }
        ],
        "TableStatus": "ACTIVE",
        "CreationDateTime": "2019-07-24T21:51:44.329000+05:30",
        "ProvisionedThroughput": {
            "NumberOfDecreasesToday": 0,
            "ReadCapacityUnits": 5,
            "WriteCapacityUnits": 5
        },
        "TableSizeBytes": 75,
        "ItemCount": 2,
        "TableArn": "arn:aws:dynamodb:us-east-2:320524107631:table/AWS_LOG",
        "TableId": "8731e2dd-469a-4282-b8ea-934817631743",
        "StreamSpecification": {
            "StreamEnabled": true,
            "StreamViewType": "NEW_AND_OLD_IMAGES"
        },
        "LatestStreamLabel": "2019-07-28T12:20:59.302",
        "LatestStreamArn": "arn:aws:dynamodb:us-east-2:320524107631:table/AWS_LOG/stream/2019-07-28T12:20:59.302"    }
}




Thanks for reading . Let me know your thoughts in the comments below    .

AWS SDK Nodejs


ec2-user@ec2 Permission denied