Saturday 14 December 2019

s3 deleteObject statusCode 204

object(Aws\Result)#312 (2) { ["data":"Aws\Result":private]=> array(4) { 
["DeleteMarker"]=> bool(false) 
["VersionId"]=> string(0) "" 
["RequestCharged"]=> string(0) "" 

["@metadata"]=> array(4) { ["statusCode"]=> int(204) 

["effectiveUri"]=> string(115) "https://dde.s3.us-east-2.amazonaws.com/upload/gbs.jpg" ["headers"]=> array(4) { ["x-amz-id-2"]=> string(76) "HNZj7VPsQ8=" 
["x-amz-request-id"]=> string(16) "0D" 
["date"]=> string(29) "Sat, 14 Dec 2019 09:05:11 GMT" 
["server"]=> string(8) "AmazonS3" } 
["transferStats"]=> array(1) { ["http"]=> array(1) { [0]=> array(0) { } } } } } ["monitoringEvents":"Aws\Result":private]=> array(0) { } }


Check is object deleted in console - if actually deleted - 

it looks apk check exists after deleting that is why 204 no content status so use


function delete_s3_object($keyname){
    try{

        $s3  = s3client();
        $result = $s3->deleteObject([
            'Bucket' => 'dddd',
            'Key'    => $keyname
        ]);

        var_dump($result);
        if($result["@metadata"]["statusCode"] === 204){
            return true;
        }else{
            return false;
        }
    } catch (S3Exception $e) {
        return false;
    }
}

Thursday 12 December 2019

chandrayaan-2-mission


With reference to the information below from the source https://www.indiatoday.in/science/story/chandrayaan-2-mission-did-vikram-lander-make-a-crash-landing-on-the-moon-1596706-2019-09-07

Scientists are also trying to find out from the data of Vikram's flight data recorder why it lost its way at an altitude of 2.1 km. A flight data recorder is a device like the black box of an aircraft.

Sources in Isro said that Vikram deviated from its path at an altitude of 2.1 km from its designated landing spot on the Moon's South Pole. After that, the lander reached 335 meters at a speed of 60 meters per second. It was at this place that Vikram lost contact with the Isro station in Bengaluru.


The key points are

point 0 is from the question why it lost its way at an altitude of 2.1 km.

what i believe the rockers attached to the lander lost it power or due to loss in power it is not able to counteract the moon gravity

so deviation from the expected path, The path is not straight down - so it is not a free fall


Next: IF we consider as free fall from this point, then also due to very small gravity of moon (1.62 m/s²)
The impact is going to be 5.98 times less than if it happen in Earth.


We do a little calculation using equation of motion considering free fall with following points

1. the lander reached 335 meters at a speed of 60 meters per second.
2. The approximate combined mass of the lander and rover is 1,471 kg (3,243 lb).
3. Gravity in moon is 1.62 m/s² - this is the constant acceleration in Moon


S = ut + (1/2)*at²

=> 335 m = 60 m/s * t + (1/2)* 1.64 * t²

=> 0.82 t² + 60 t - 335 = 0

=> t = 5.212 sec to reach the moon surface

=> final velocity - when it hit the moon surface

v = u + at

v = 60 m/s + 1.64 m/s² * 5.212 s

v = 68.54768 m/s it is about (246.77 km/hr) is the final velocity - when it hit the moon surface - if it is considering free fall


Here the communication delay from moon to earth is critical
(The delay for Earth-Moon communications is about 1.25 second (distance is ~ 380,000 km, the speed of light is ~300,000 km/s))

So at the time we receive the information that "the lander reached 335 meters at a speed of 60 meters per second"
The lander actually at the speed of 62.085 m/s and at the distance of 274 m from moon surface.

Thus the final conclusion is
1. The delay we use here 1.25 s may be high some times due to hardware limitations,
2. The other important issue is that the measuring object position and point on the surface of the  moon, 
landing point is not same as place user for measurement, the difference in height between these two places in moon from the point of measurement

The above two point narrow down the actual distance "the lander reached 335 meters at a speed of 60 metres per second"

So, probably the lander lost its communication only after landing.

File upload to S3 using aws php sdk


Step 1. Create AWS IAM user with s3 full access and api access only option








Step 2: Create a user Group with s3 full access


Step 3: Add AWS IAM user to to group created

 Step 4: Finally on creating the user it will show you user credentials also one time download file with credential to use IAM user


Then go to iam user
Step 5: click on the user menu in the list, u can get the ARN - copy have it for further use

6. Next: Step is creating S3 bucket
7. Now Allow this bucket to access from IAM user using bucket policy


8. go to policy generator

https://awspolicygen.s3.amazonaws.com/policygen.html



This is like whom (IAM) to get access to what resource (S3)

generate policy and copy past to bucket policy in point 7.




Finally use php AWS sdk to access bucket from php code
Example:
https://gunabalans.blogspot.com/2019/09/aws-s3-file-upload-using-php-sdk.html