0

I am trying to setup a boto3 client to use the AWS personalize service along the lines of what is done here:

https://docs.aws.amazon.com/personalize/latest/dg/data-prep-importing.html

I have faithfully followed the tutorial up to this point. I have my s3 bucket set up, and I have an appropriately formatted csv.

I configured my access and secret tokens and can successfully perform basic operations on my s3 bucket, so I think that part is working:

import s3fs
fs = s3fs.S3FileSystem()
fs.ls('personalize-service-test')
'personalize-test/data'

When I try to create my service, things start to fail:

import boto3
personalize = boto3.client('personalize')

---------------------------------------------------------------------------
UnknownServiceError                       Traceback (most recent call last)
<ipython-input-13-c23d30ee6bd1> in <module>
----> 1 personalize = boto3.client('personalize')

/anaconda3/envs/ds_std_3.6/lib/python3.6/site-packages/boto3/__init__.py in client(*args, **kwargs)
     89     See :py:meth:`boto3.session.Session.client`.
     90     """
---> 91     return _get_default_session().client(*args, **kwargs)
     92 
     93 

/anaconda3/envs/ds_std_3.6/lib/python3.6/site-packages/boto3/session.py in client(self, service_name, region_name, api_version, use_ssl, verify, endpoint_url, aws_access_key_id, aws_secret_access_key, aws_session_token, config)
    261             aws_access_key_id=aws_access_key_id,
    262             aws_secret_access_key=aws_secret_access_key,
--> 263             aws_session_token=aws_session_token, config=config)
    264 
    265     def resource(self, service_name, region_name=None, api_version=None,

/anaconda3/envs/ds_std_3.6/lib/python3.6/site-packages/botocore/session.py in create_client(self, service_name, region_name, api_version, use_ssl, verify, endpoint_url, aws_access_key_id, aws_secret_access_key, aws_session_token, config)
    836             is_secure=use_ssl, endpoint_url=endpoint_url, verify=verify,
    837             credentials=credentials, scoped_config=self.get_scoped_config(),
--> 838             client_config=config, api_version=api_version)
    839         monitor = self._get_internal_component('monitor')
    840         if monitor is not None:

/anaconda3/envs/ds_std_3.6/lib/python3.6/site-packages/botocore/client.py in create_client(self, service_name, region_name, is_secure, endpoint_url, verify, credentials, scoped_config, api_version, client_config)
     77             'choose-service-name', service_name=service_name)
     78         service_name = first_non_none_response(responses, default=service_name)
---> 79         service_model = self._load_service_model(service_name, api_version)
     80         cls = self._create_client_class(service_name, service_model)
     81         endpoint_bridge = ClientEndpointBridge(

/anaconda3/envs/ds_std_3.6/lib/python3.6/site-packages/botocore/client.py in _load_service_model(self, service_name, api_version)
    115     def _load_service_model(self, service_name, api_version=None):
    116         json_model = self._loader.load_service_model(service_name, 'service-2',
--> 117                                                      api_version=api_version)
    118         service_model = ServiceModel(json_model, service_name=service_name)
    119         return service_model

/anaconda3/envs/ds_std_3.6/lib/python3.6/site-packages/botocore/loaders.py in _wrapper(self, *args, **kwargs)
    130         if key in self._cache:
    131             return self._cache[key]
--> 132         data = func(self, *args, **kwargs)
    133         self._cache[key] = data
    134         return data

/anaconda3/envs/ds_std_3.6/lib/python3.6/site-packages/botocore/loaders.py in load_service_model(self, service_name, type_name, api_version)
    376             raise UnknownServiceError(
    377                 service_name=service_name,
--> 378                 known_service_names=', '.join(sorted(known_services)))
    379         if api_version is None:
    380             api_version = self.determine_latest_version(

UnknownServiceError: Unknown service: 'personalize'. Valid service names are: acm, acm-pca, alexaforbusiness, amplify, apigateway, apigatewaymanagementapi, apigatewayv2, application-autoscaling, appmesh, appstream, appsync, athena, autoscaling, autoscaling-plans, backup, batch, budgets, ce, chime, cloud9, clouddirectory, cloudformation, cloudfront, cloudhsm, cloudhsmv2, cloudsearch, cloudsearchdomain, cloudtrail, cloudwatch, codebuild, codecommit, codedeploy, codepipeline, codestar, cognito-identity, cognito-idp, cognito-sync, comprehend, comprehendmedical, config, connect, cur, datapipeline, datasync, dax, devicefarm, directconnect, discovery, dlm, dms, docdb, ds, dynamodb, dynamodbstreams, ec2, ecr, ecs, efs, eks, elasticache, elasticbeanstalk, elastictranscoder, elb, elbv2, emr, es, events, firehose, fms, fsx, gamelift, glacier, globalaccelerator, glue, greengrass, guardduty, health, iam, importexport, inspector, iot, iot-data, iot-jobs-data, iot1click-devices, iot1click-projects, iotanalytics, kafka, kinesis, kinesis-video-archived-media, kinesis-video-media, kinesisanalytics, kinesisanalyticsv2, kinesisvideo, kms, lambda, lex-models, lex-runtime, license-manager, lightsail, logs, machinelearning, macie, marketplace-entitlement, marketplacecommerceanalytics, mediaconnect, mediaconvert, medialive, mediapackage, mediastore, mediastore-data, mediatailor, meteringmarketplace, mgh, mobile, mq, mturk, neptune, opsworks, opsworkscm, organizations, pi, pinpoint, pinpoint-email, pinpoint-sms-voice, polly, pricing, quicksight, ram, rds, rds-data, redshift, rekognition, resource-groups, resourcegroupstaggingapi, robomaker, route53, route53domains, route53resolver, s3, s3control, sagemaker, sagemaker-runtime, sdb, secretsmanager, securityhub, serverlessrepo, servicecatalog, servicediscovery, ses, shield, signer, sms, sms-voice, snowball, sns, sqs, ssm, stepfunctions, storagegateway, sts, support, swf, textract, transcribe, transfer, translate, waf, waf-regional, workdocs, worklink, workmail, workspaces, xray

Indeed the service name 'personalize' is missing from the list.

I already tried upgrading boto3 and botocore to their latest version and restarting my kernel.

boto3           1.9.143 
botocore        1.12.143

Any idea as to what to try next would be great.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Sledge
  • 1,245
  • 1
  • 23
  • 47

3 Answers3

3

Have you signed up for the preview through the landing page? Personalize is still in limited preview, so your account will not be able to access it through boto3 by default, unless otherwise whitelisted.

Edit: Personalize is currently publicly available, so this answer is no longer relevant.

Nick Walsh
  • 1,807
  • 5
  • 16
3

The boto3 documentation does not (currently on 1.9.143) list personalize as a supported service.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
0

I had neglected to perform these setup steps:

https://docs.aws.amazon.com/personalize/latest/dg/aws-personalize-set-up-aws-cli.html

When I did that and restarted my kernel, boto3 picked up the service definition and now things seem to work.

Sledge
  • 1,245
  • 1
  • 23
  • 47