Service error when creating amazon lambda function - python

Hi I am trying to create a lambda function in amazon lambda. Just trying to follow the python tutorial.
After following all the steps I get a "Service Error" when creating the function.
I found this forum discussing about this link to the forum.
I checked with all the environments but still it gives me the service error.
error
Is it a configuration issue or a problem with the account ?
I am totally new to aws. Appreciate any help regarding this.

I was having this problem, but it disappeared when I selected "Choose an existing role" instead of letting the wizard create a role, under "Lambda function handler and role". If I create a role manually I can then assign it to the Lambda afterwards. Maybe that'll help you, too?

I had this problem, too. In my case, I had "Enable active tracing" selected. I tried un-checking that option and it got rid of the error. Maybe I had a permissions problem w/XRay? Who knows; I didn't investigate further.

Related

Troubleshooting custom domain using Zappa

I’m doing some troubleshooting for a custom domain (purchased via Google). I’ve updated the custom resource record in Google, done the route 53 + AWS cert manager steps, and ran zappa certify (as well as zappa update). My first thought… is it supposed to show the AWS link after the custom domain: e.g.,
Your updated Zappa is live!: https://customDomain.com (https://abc123.amazonaws.com/dev)
At the moment, the amazonaws link still works, but the custom domain does not. Curious if this could indicate anything per anyone’s experience?
Resolved my own issue ... simple mistake.
In Google Domains, I was using 'Default Name Servers' with CNAME customer records. Instead, I needed to use 'Custom Name Servers' and activated the 4 names servers from route 53. Hopefully this helps anyone who encounters similar troubleshooting w AWS/Google/Zappa!

Access Denied when attempting to create bucket in AWS w/ Python

I am going through a bootcamp and one project is to create a bucket in aws using python scripting. I keep getting an access denied error and im not sure why? Any help would be much appreciated.
enter image description here
#samrah there are many different scenarios to Access Denied
Major, your admin(in case if someone gives access to AWS), not gave permission to CREATe bucket
Other probably the Access Keys issue.
It's a good way always to share code snippet, so the community will help easily.

gcloud monitoring_v3 query fails on AttributeError 'WhichOneof'

Im using this lib for a while, everything was working great. Using it to query cpu utilization of gcloud machines.
this is my code:
query_obj = Query(metric_service_client, project, "compute.googleapis.com/instance/cpu/utilization",
minutes=mins_backward_check)
metric_res = query_obj.as_dataframe()
Everything was working fine until lately it started to fail.
I'm getting:
{AttributeError}'WhichOneof'
Deubbing it, i see it fails inside "as_dataframe()" code, specifically in this part:
data=[_extract_value(point.value) for point in time_series.points]
When it tries to extract the value from the point object.
The _extract_value values code seems to use the WhichOneof attribute which seems to be related to protobuff lib.
I didn't change any of those libs versions, anyone has any clue what causes it to fail now?
If you're confident (!) that you've not changed anything, then this would appear to be Google breaking its API and you may wish to file an issue on Google's issue tracker on one of these components:
https://issuetracker.google.com/issues/new?component=187228&template=1162638
https://issuetracker.google.com/issues/new?component=187143&template=800102
I think Cloud Monitoring is natively a gRPC-based API which would explain the protobuf reference.
A good sanity check is to use APIs Explorer and check the method you're using there to see whether you can account for the request|response, perhaps:
https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/query
NOTE Your question may be easy to parse for someone familiar with the Cloud Monitoring Python SDK but isn't easy to repro. Please consider providing a simple repro of your issue, including requirements.txt and a full code snippet.

How to create Azure Application gateway using python SDK

I'm starting to feel a bit stupid. Have someone been able to successfully create an Application gateway using Python SDK for Azure?
The documentation seems ok, but I'm struggling with finding the right parameters to pass 'parameters' of
azure.mgmt.network.operations.ApplicationGatewaysOperations application_gateways.create_or_update(). I found a complete working example for load_balancer but can't find anything for Application gateway. Getting 'string indices must be integers, not str' doesn't help at all. Any help will be appreciated, Thanks!
Update: Solved. An advice for everyone doing this, look carefully for the type of data required for the Application gateway params
I know there is no Python sample for Application Gateway currently, I apologize for that...
Right now I suggest you to:
Create the Network client using this tutorial or this one
Take a look at this ARM template for Application Gateway. Python parameters will be very close from this JSON. At worst, you can deploy an ARM template using the Python SDK too.
Take a look at the ReadTheDocs page of the create operation, will give you the an idea of what is expected as parameters.
Open an issue on the Github tracker, so you can follow when I do a sample (or at least a unit test you can mimic).
Edit after question in comment:
To get the IP of VM once you have a VM object:
# Gives you the ID if this NIC
nic_id = vm.network_profile.network_interfaces[0].id
# Parse this ID to get the nic name
nic_name = nic_id.split('/')[-1]
# Get the NIC instance
nic = network_client.network_interfaces.get('RG', nic_name)
# Get the actual IP
nic.ip_configurations[0].private_ip_address
Edit:
I finally wrote the sample:
https://github.com/Azure-Samples/network-python-manage-application-gateway
(I work at MS and I'm responsible of the Azure SDK for Python)

How to solve "Insufficient Permission" for userUsageReport with Google API?

I'm trying to write a Python script that will check if a user account has got two-step verification enabled.
As a starting point, I'm using the quickstart script provided on https://developers.google.com/admin-sdk/reports/v1/quickstart/python. I've followed the instructions and the sample code works as expected.
I then add the following line after the example code:
results = service.userUsageReport().get(userKey='john.doe#example.com', date='2016-08-02', parameters='accounts:is_2sv_enrolled').execute()
but I get "Insufficient Permission" returned.
Just to make it clear, I do replace "john.doe#example.com" with an email address that is valid for my organisation :).
I've double-checked the credentials used and, indeed, if I use the web-based API Explorer with the same account being used to run the script, it works.
I don't understand why the call to activities().list() is working but userUsageReport().get() isn't.
I've solved this.
userUsageReport requires the usage scope to be added, specifically:
https://www.googleapis.com/auth/admin.reports.usage.readonly
Since the quickstart only reference the audit scope:
https://www.googleapis.com/auth/admin.reports.audit.readonly
that is why I was getting the error.

Categories

Resources