Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS CLI: describe-import-snapshot-tasks returns snapshotId attribute while it's in progress #9118

Closed
1 task done
tanmoysinha opened this issue Dec 3, 2024 · 3 comments
Closed
1 task done
Labels
bug This issue is a bug. documentation This is a problem with documentation. ec2 p2 This is a standard priority issue potential-regression Marking this issue as a potential regression to be checked by team member

Comments

@tanmoysinha
Copy link

tanmoysinha commented Dec 3, 2024

Describe the bug

AWS EC2 describe-import-snapshot-tasks is not expected to return the SnapshotId attribute when the import snapshot task that is in progress, reference: https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-import-snapshot-tasks.html.

However observed, an empty string value is returned for the attribute SnapshotId

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

$ aws ec2 describe-import-snapshot-tasks --import-task-ids "import-snap-247b055a63e5a470t" --profile sen_cloud_img_producer_aws 
{
    "ImportSnapshotTasks": [
        {
            "Description": "Debug Sensor Import",
            "ImportTaskId": "import-snap-247b055a63e5a470t",
            "SnapshotTaskDetail": {
                "DiskImageSize": 0.0,
                "Format": "VHD",
                "Status": "pending",
                "UserBucket": {
                    "S3Bucket": "scloud-dev",
                    "S3Key": "Sensor.vhd"
                }
            },
            "Tags": []
        }
    ]
}

Current Behavior

Notice the SnapshotId attribute is returned as an empty string.

$ aws ec2 describe-import-snapshot-tasks --import-task-ids "import-snap-247b055a63e5a470t" --profile sen_cloud_img_producer_aws 
{
    "ImportSnapshotTasks": [
        {
            "Description": "Debug Import",
            "ImportTaskId": "import-snap-247b055a63e5a470t",
            "SnapshotTaskDetail": {
                "DiskImageSize": 0.0,
                "Format": "VHD",
                **"SnapshotId": "",**
                "Status": "active",
                "UserBucket": {
                    "S3Bucket": "cloud-dev",
                    "S3Key": "Sensor.vhd"
                }
            },
            "Tags": []
        }
    ]
}
### Reproduction Steps

$ aws --version
aws-cli/1.22.34 Python/3.10.12 Linux/6.2.0-26-generic botocore/1.23.34

$ cat container.json 
{

    "Description": "Debug Sensor Import",
    "Format": "VHD",
    "UserBucket": {
        "S3Bucket": "cloud-dev",
        "S3Key": "Sensor.vhd"
    }
}

$ aws s3 cp Sensor.vhd s3://cloud-dev --profile sen_cloud_img_producer_aws
upload: ./Sensor.vhd to s3://cloud-dev/Sensor.vhd

$ aws ec2 import-snapshot --description "Debug Sensor Import" --disk-container file://container.json/     --profile sen_cloud_img_producer_aws
{
    "Description": "Debug Sensor Import",
    "ImportTaskId": "import-snap-247b055a63e5a470t",
    "SnapshotTaskDetail": {
        "DiskImageSize": 0.0,
        "Format": "VHD",
        "Progress": "0",
        "Status": "active",
        "StatusMessage": "pending",
        "UserBucket": {
            "S3Bucket": "cloud-dev",
            "S3Key": "Sensor.vhd"
        }
    }
}

$ aws ec2 describe-import-snapshot-tasks --import-task-ids "import-snap-247b055a63e5a470t" --profile sen_cloud_img_producer_aws 
{
    "ImportSnapshotTasks": [
        {
            "Description": "Debug Import",
            "ImportTaskId": "import-snap-247b055a63e5a470t",
            "SnapshotTaskDetail": {
                "DiskImageSize": 0.0,
                "Format": "VHD",
                "SnapshotId": "",
                "Status": "active",
                "UserBucket": {
                    "S3Bucket": "cloud-dev",
                    "S3Key": "Sensorvhd"
                }
            },
            "Tags": []
        }
    ]
}

Possible Solution

No response

Additional Information/Context

The same aws cli version has worked in our build pipeline on 12 Sep 2024.

$> aws configure list --profile sen_cloud_img_producer_aws
      Name                    Value             Type    Location
      ----                    -----             ----    --------
   profile sen_cloud_img_producer_aws           manual    --profile
access_key     ****************XXXX shared-credentials-file    
secret_key     ****************YYYY shared-credentials-file    
    region               ap-south-1      config-file    ~/.aws/config

CLI version used

aws-cli/1.22.34 Python/3.10.12 Linux/6.2.0-26-generic botocore/1.23.34

Environment details (OS name and version, etc.)

Ubuntu 22.04.5 LTS

@tanmoysinha tanmoysinha added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Dec 3, 2024
@github-actions github-actions bot added the potential-regression Marking this issue as a potential regression to be checked by team member label Dec 3, 2024
@tim-finnigan tim-finnigan self-assigned this Dec 3, 2024
@tim-finnigan
Copy link
Contributor

Thanks for reaching out. I think this is an issue with the example in the CLI documentation, which was written 5 years ago: https://github.com/aws/aws-cli/blob/develop/awscli/examples/ec2/describe-import-snapshot-tasks.rst?plain=1

This screenshot shows the discrepancies between that example and what I got when testing on the latest AWS CLI version:
(It looks like there is also an extra Description in the documented example.)

image

The describe-import-snapshot-tasks command makes a request to the underlying DescribeImportSnapshotTasks API — if the API behavior changed and is not returning what is expected, then we might need to escalate this to the EC2 team internally. But in this case, an array of ImportSnapshotTask objects is expected in the API response, which contains SnapshotTaskDetail objects, and snapshotId is documented there, so I think the API behavior is expected.

Also I should note CLI version you referenced (1.22.34) is very old — the latest version of v1 is 1.36.14. We also recommend migrating to v2 of the CLI if possible.

@tim-finnigan tim-finnigan added documentation This is a problem with documentation. p2 This is a standard priority issue ec2 and removed needs-triage This issue or PR still needs to be triaged. potential-regression Marking this issue as a potential regression to be checked by team member labels Dec 3, 2024
@tim-finnigan tim-finnigan removed their assignment Dec 3, 2024
@github-actions github-actions bot added the potential-regression Marking this issue as a potential regression to be checked by team member label Dec 3, 2024
Copy link

github-actions bot commented Dec 3, 2024

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

@tanmoysinha
Copy link
Author

Closing, as an answer was provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. documentation This is a problem with documentation. ec2 p2 This is a standard priority issue potential-regression Marking this issue as a potential regression to be checked by team member
Projects
None yet
Development

No branches or pull requests

2 participants