Skip to content

(aws-s3-assets): Object keys don't preserve the full extension name #12699

@zhangfand

Description

@zhangfand

I'm using aws-s3-assets to upload data artifacts I used for a Sagemaker model. According to the documentation of Sagemaker, the S3 object needs to end with tar.gz extension. However, the uploaded asset is renamed to <random-id>.gz.

Reproduction Steps

import * as cdk from "@aws-cdk/core";
import * as s3assets from "@aws-cdk/aws-s3-assets";

export class ModelStack extends cdk.Stack {
    constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
        super(scope, id, props);
        const modelArtifactAsset = new s3assets.Asset(this, 'ModelArtifact', {
            path: "artifact.tar.gz"
        });
        new cdk.CfnOutput(this, "modelArtifactS3Url", {
            description: "S3 url to the model artifact.",
            exportName: "modelArtifactS3Url",
            value: modelArtifactAsset.s3ObjectUrl,
        });
    }
}

What did you expect to happen?

I expect the s3 object key is ended with tar.gz

What actually happened?

The generated object is named as <id>.gz. Here is an example output from one run:
s3://<bucket-name>/assets/f43ce33c42b10b3e1fe78d87a46cd0dff8611c37637edcf1857a36c33f302ee5.gz

Environment

  • CDK CLI Version :: 1.85.0
  • Framework Version:: 1.86.0
  • Node.js Version:: v15.2.0
  • OS : Mac OS X
  • Language (Version): Typescript 3.9.7

Other

A possible fix is to add an optional parameter for customize the extension name of the asset.


This is 🐛 Bug Report

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-s3-assetsbugThis issue is a bug.effort/smallSmall work item – less than a day of effortin-progressThis issue is being actively worked on.p1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions