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

Personalize: Wrong attribute created in cloudformation (Python) #29411

Closed
ricciocri opened this issue Mar 8, 2024 · 5 comments
Closed

Personalize: Wrong attribute created in cloudformation (Python) #29411

ricciocri opened this issue Mar 8, 2024 · 5 comments
Labels
@aws-cdk/aws-personalize Related to Amazon Personalize bug This issue is a bug. effort/small Small work item – less than a day of effort p2

Comments

@ricciocri
Copy link

ricciocri commented Mar 8, 2024

Describe the bug

While creating a dataset job import for a personalize dataset with Python and cdk 2.130 the resulted cloudformation has a wrong attribute and so the deploy fails.

The correct attribute in cloudformation should be DataLocation : https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-personalize-dataset-datasource.html

Expected Behavior

This is the expected cloudformation

"Type": "AWS::Personalize::Dataset",
   "Properties": {
    "DatasetGroupArn": "arn:aws:personalize:eu-west-1:xxxxxxxxx:dataset-group/personalize-dsg",
    "DatasetImportJob": {
     "DataSource": {
      "**DataLocation**": "s3://my_bucket/my_path/users.csv"
     },
     "JobName": "personalize-users-import-job",
     "RoleArn": {
      "Fn::GetAtt": [
       "PersonalizeRole6C121A81",
       "Arn"
      ]
     }
    },
    "DatasetType": "Users",
    "Name": "personalize-users",
    "SchemaArn": {
     "Fn::GetAtt": [
      "usersschema",
      "SchemaArn"
     ]
    }
   },
   "Metadata": {
    "aws:cdk:path": "prod-personalize-stack/personalize-users"
   }
  },

Current Behavior

This is the output of the cloudformation in cdk.out

"Type": "AWS::Personalize::Dataset",
   "Properties": {
    "DatasetGroupArn": "arn:aws:personalize:eu-west-1:xxxxxxxxx:dataset-group/personalize-dsg",
    "DatasetImportJob": {
     "DataSource": {
      "**dataLocation**": "s3://my_bucket/my_path/users.csv"
     },
     "JobName": "personalize-users-import-job",
     "RoleArn": {
      "Fn::GetAtt": [
       "PersonalizeRole6C121A81",
       "Arn"
      ]
     }
    },
    "DatasetType": "Users",
    "Name": "personalize-users",
    "SchemaArn": {
     "Fn::GetAtt": [
      "usersschema",
      "SchemaArn"
     ]
    }
   },
   "Metadata": {
    "aws:cdk:path": "prod-personalize-stack/personalize-users"
   }
  },`

Reproduction Steps

create a dataset and its importjob:

personalize.CfnDataset(
self,
dataset_name,
name=my_dataset,
dataset_type=ITEMS,
dataset_group_arn=dataset_group_arn,
schema_arn=schema_arn,
dataset_import_job=personalize.CfnDataset.DatasetImportJobProperty(
job_name=my-import-job",
role_arn=self._personalize_role.role_arn,
data_source=personalize.CfnDataset.DataSourceProperty(
data_location="s3://mybucket/mypath/items.csv",
),
)
)

Just do a synth anche check the datalocation

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.130

Framework Version

No response

Node.js Version

v18.19.1

OS

Debian 12

Language

Python

Language Version

No response

Other information

No response

@ricciocri ricciocri added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Mar 8, 2024
@github-actions github-actions bot added the @aws-cdk/aws-personalize Related to Amazon Personalize label Mar 8, 2024
@pahud
Copy link
Contributor

pahud commented Mar 8, 2024

The dataSource is type any(see doc) so you need to construct a JSON like

data_source={'dataLocation': 's3://my_bucket/my_path/users.csv'}

Let me know if it works for you.

@pahud pahud added p2 effort/small Small work item – less than a day of effort response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels Mar 8, 2024
Copy link

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Mar 10, 2024
@ricciocri
Copy link
Author

Hello @pahud,

Thanks for the info, I confirm that using a Json it works.
So probably it's the personalize.CfnDataset.DataSourceProperty to be checked, but for my use case I'm set.

Thanks.

@github-actions github-actions bot removed closing-soon This issue will automatically close in 4 days unless further comments are made. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. labels Mar 11, 2024
@pahud
Copy link
Contributor

pahud commented Mar 12, 2024

Yeah if you are using CDK in Python. Make sure to check the CDK API reference, if the prop type is any, just use the JSON and it will be good. Hope everything is doing great with you.

@pahud pahud closed this as completed Mar 12, 2024
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-personalize Related to Amazon Personalize bug This issue is a bug. effort/small Small work item – less than a day of effort p2
Projects
None yet
Development

No branches or pull requests

2 participants