0

The following code is given below for my lambda funciton

import boto3

client = boto3.client('neptune') response =
client.stop_db_cluster(DBClusterIdentifier='qa-n1-cluster')

output is given below

Response: { "errorMessage": "'Neptune' object has no attribute 'stop_db_cluster'", "errorType": "AttributeError", "stackTrace": [ " File \"/var/lang/lib/python3.8/imp.py\", line 234, in load_module\n return load_source(name, filename, file)\n", " File \"/var/lang/lib/python3.8/imp.py\", line 171, in load_source\n module = _load(spec)\n", " File \"\", line 702, in _load\n", " File \"\", line 671, in _load_unlocked\n", " File \"\", line 783, in exec_module\n", " File \"\", line 219, in _call_with_frames_removed\n", " File \"/var/task/lambda_function.py\", line 4, in \n response = client.stop_db_cluster(DBClusterIdentifier='qa-n1-cluster')\n", " File \"/var/runtime/botocore/client.py\", line 514, in getattr\n raise AttributeError(\n" ] }

The-Big-K
  • 2,672
  • 16
  • 35
eksm27
  • 23
  • 4

2 Answers2

2

You need boto version 1.11.721 (2020-02-12) or higher to be exact.

Change Log: https://github.com/aws/aws-sdk-java/blob/master/CHANGELOG.md

1.11.721 2020-02-12

Amazon Neptune

This launch enables Neptune start-db-cluster and stop-db-cluster. Stopping and starting Amazon Neptune clusters helps you manage costs for development and test environments. You can temporarily stop all the DB instances in your cluster, instead of setting up and tearing down all the DB instances each time that you use the cluster.

Upgrade your boto version, and confirm that you are on a version newer than this.

Community
  • 1
  • 1
The-Big-K
  • 2,672
  • 16
  • 35
1

stop_db_cluster() and start_db_cluster() are newer APIs (only released as of a couple of weeks ago. Can you please validate that you're on the latest version of boto3?

pip install --upgrade boto3

Taylor Riggan
  • 1,963
  • 6
  • 12
  • yes, i referred this link.. https://docs.aws.amazon.com/lambda/latest/dg/python-package.html – eksm27 Mar 09 '20 at 14:26
  • looks like, it is working on terminal with out any development tool.. we are facing the same issue in pycharm since updated the boto3 version.. my current boto3 version is 1.12.19 in pycharm – eksm27 Mar 12 '20 at 06:46
  • C:\Users\keswarm\venv\AWS-jobs-automate\Scripts\python.exe C:/Users/keswarm/PycharmProjects/AWS-jobs-automate/neptune.py Traceback (most recent call last): File "C:/Users/keswarm/PycharmProjects/AWS-jobs-automate/neptune.py", line 5, in sn = client.stop_db_clusters(DBClusterIdentifier=clustername) File "C:\Users\keswarm\venv\AWS-jobs-automate\lib\site-packages\botocore\client.py", line 566, in __getattr__ self.__class__.__name__, item) AttributeError: 'Neptune' object has no attribute 'stop_db_clusters' Process finished with exit code 1 – eksm27 Mar 12 '20 at 06:48
  • AWS-jobs-automate) C:\Users\keswarm\PycharmProjects\AWS-jobs-automate>pip show boto3 Name: boto3 Version: 1.12.19 Summary: The AWS SDK for Python Home-page: https://github.com/boto/boto3 Author: Amazon Web Services Author-email: UNKNOWN License: Apache License 2.0 Location: c:\users\keswarm\venv\aws-jobs-automate\lib\site-packages Requires: jmespath, s3transfer, botocore – eksm27 Mar 12 '20 at 06:49