AWS SES Email Verification RequestId status - amazon-web-services

Working on AWS SES Email Verification, after verifying an email i get back a RequestId from the response. Im trying to find a way to get an update form that RequestId i cant find a endpoint or method that can give me an update on this RequestId status.
{
ResponseMetadata: { RequestId: '1234567890' }
}
Here is the docs that im using for the Email Verification https://docs.aws.amazon.com/ses/latest/DeveloperGuide/verify-email-addresses-procedure.html

You can't track the status of email verification using the RequestId received from SES email verification response. Pasting a sample response from SES email verification.
{'ResponseMetadata': {'RetryAttempts': 0, 'HTTPStatusCode': 200, 'RequestId': 'abcd-xyz-123', 'HTTPHeaders': {'date': 'Wed, 26 May 2021 04:44:03 GMT', 'x-amzn-requestid': '98768888-1111-qwaq-2222', 'content-length': '248', 'content-type': 'text/xml', 'connection': 'keep-alive'}}}
To get the status of the email verification, you can try list_verified_email_addresses operation. It list out all the verified email addresses. Check whether your required email address is listing in VerifiedEmailAddresses. If it is not there then it is not yet verified.
import boto3
from botocore.config import Config
my_config = Config(region_name = 'us-west-2')
ses = boto3.client('ses', config=my_config)
response = ses.list_verified_email_addresses()
print(response)
Response:
{'ResponseMetadata': {'RetryAttempts': 0, 'HTTPStatusCode': 200, 'RequestId': 'xxxxx', 'HTTPHeaders': {'date': 'Wed, 26 May 2021 05:25:00 GMT', 'x-amzn-requestid': 'xxxxxx', 'content-length': '412', 'content-type': 'text/xml', 'connection': 'keep-alive'}}, u'VerifiedEmailAddresses': ['example#gmail.com']}

Related

Fetch IAM Username as the output

`We are running an AWS Glue job and we believe the following code snippet should return the AWS UserId from which the job is being triggered.
For ex, the following code was run with the user mmohanty
import boto3 client = boto3.client('sts') response = client.get_caller_identity() print('User ID:', response['UserId'])
The output is being shown as **AROA6CNCYWLF5MGCB5DF4:GlueJobRunnerSession **instead of IAM username.
The entire output of client.get_caller_identity() doesn't have any reference to IAM username.
{'UserId': 'AROA6CNCYWLF5MGCB5DF4:GlueJobRunnerSession', 'Account': '1234567', 'Arn': 'arn:aws:sts::12345678:assumed-role/xxx-GlueRole/GlueJobRunnerSession', 'ResponseMetadata': {'RequestId': 'bb43bd2b-4426-46b5-8457-aaaaaaa92116d', 'HTTPStatusCode': 200, 'HTTPHeaders': {'x-amzn-requestid': 'bb43bd2b-4426-46b5-8457-aaaaaaa2116d', 'content-type': 'text/xml', 'content-length': '459', 'date': 'Fri, 20 Jan 2023 17:31:27 GMT'}, 'RetryAttempts': 0}}
Please let us know how to get IAM username instead of the cryptic userid.
We are getting cryptic Userid instead of actual IAM username.`

Can't receive text message using SNS python Lambda

I've read everything possible about SNS and I can't figure out why any text messages are sent from an aws lambda function.
My function can't be more simple:
def send_sms(message):
print ("sending message...")
print(message)
client = boto3.client("sns")
response = client.publish(
PhoneNumber="+336xxxxxxxxx",
Message=message
)
print (response)
I'm using an SNSFullAccess for this lambda function.
And my log for the print (response) are:
{'MessageId': '6e9aa592-4ff7-5cf1-be92-ffe34ca16120',
'ResponseMetadata': {'RequestId':
'5d73d693-b584-5ecb-926f-8ce2b6d2831a', 'HTTPStatusCode': 200,
'HTTPHeaders': {'x-amzn-requestid':
'5d73d693-b584-5ecb-926f-8ce2b6d2831a', 'content-type': 'text/xml',
'content-length': '294', 'date': 'Sun, 30 Jan 2022 21:20:22 GMT'},
'RetryAttempts': 0}}

How to restore from 429 Resource has been exhausted (e.g. check quota)

my questions are simple, I am using PEOPLE API and I have skipped the quota limit for one of the users using the API, the error is only shown when trying to create a new contact for this specific user.
The error says code: 429, message: Resource has been exhausted (e.g. check quota).
How can I restore the user to use the API again?
If the limits are reset every minute, how is it possible that after 3 days the user is still blocked?
I do not want to increase the quota, what I want is to restore the quota again.
Additionally to this in my developer panel there is no indication that I have exceeded the quota which for PEOPLE API is limited to 90 per minute.
My code is:
const request = {
requestBody: contact
}
service.people.createContact(request)
.then((res)=>{
console.log('Done to create a contact', res.data);
})
.catch((err)=>{
console.log('Error', err);
})
And the retuning massage is:
response: {
config: {
url: 'https://people.googleapis.com/v1/people:createContact',
method: 'POST',
paramsSerializer: [Function],
data: [Object],
headers: [Object],
params: [Object: null prototype] {},
validateStatus: [Function],
body: '{"names":[{"familyName":"PASIEGA","givenName":"HOTEL","middleName":"VILLA","unstructuredName":"HOTEL VILLA PASIEGA"}],"addresses":[{"type":"home","streetAddress":"LAS BARRERAS, SN","city":"HOZNAYO","region":"S","postalCode":"39716","country":"ESPAÑA","countryCode":"ES"}],"emailAddresses":[{"value":"reservas#grupolospasiegos.com","type":"work"}],"phoneNumbers":[{"value":"785 52 12 58","type":"Villa Pasiega"},{"value":"785 52 12 58","type":"workFax"}],"biographies":[{"value":"Hotel los Pasiegos - Grupoo los Pasiegos","contentType":"TEXT_PLAIN"}],"urls":[{"value":"http://grupolospasiegos.com/contacto/","type":"profile"}],"organizations":[{"type":"Other","name":"HOTEL VILLA PASIEGA","title":"RESERVA"}],"memberships":[{"contactGroupMembership":{"contactGroupResourceName":"contactGroups/199bb8970e07b6a8"}},{"contactGroupMembership":{"contactGroupResourceName":"contactGroups/55fdbf598e048c03"}},{"contactGroupMembership":{"contactGroupResourceName":"contactGroups/5ee644148f02b901"}}]}',
responseType: 'json'
},
data: { error: [Object] },
headers: {
'alt-svc': 'h3-Q050=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-T050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"',
'cache-control': 'private',
connection: 'close',
'content-encoding': 'gzip',
'content-type': 'application/json; charset=UTF-8',
date: 'Thu, 22 Oct 2020 12:47:16 GMT',
server: 'ESF',
'transfer-encoding': 'chunked',
vary: 'Origin, X-Origin, Referer',
'x-content-type-options': 'nosniff',
'x-frame-options': 'SAMEORIGIN',
'x-xss-protection': '0'
},
status: 429,
statusText: 'Too Many Requests'
},config: {
url: 'https://people.googleapis.com/v1/people:createContact',
method: 'POST',
paramsSerializer: [Function],
data: {
names: [Array],
addresses: [Array],
emailAddresses: [Array],
phoneNumbers: [Array],
biographies: [Array],
urls: [Array],
organizations: [Array],
memberships: [Array]
},
headers: {
'Accept-Encoding': 'gzip',
'User-Agent': 'google-api-nodejs-client/0.7.2 (gzip)',
Authorization: 'Bearer ya29.a0AfH6SMAJtuUp3vLhSXlDVyAd80iQc1D-mYZUD7mENq12vTiegBAV834dTGYbpuuVN9wCpJ0JBB51oMwEozhb9_xoM7s9NTiwqBicNYZAjzPpjLL4MvQUp8b-Oqju8opyNwDAJWCnLvUJ5Bvz266z5H1ZXIpe3_YstXDRzw',
'Content-Type': 'application/json',
Accept: 'application/json'
},
params: [Object: null prototype] {},
validateStatus: [Function],
body: '{"names":[{"familyName":"PASIEGA","givenName":"HOTEL","middleName":"VILLA","unstructuredName":"HOTEL VILLA PASIEGA"}],"addresses":[{"type":"home","streetAddress":"LAS BARRERAS, SN","city":"HOZNAYO","region":"S","postalCode":"39716","country":"ESPAÑA","countryCode":"ES"}],"emailAddresses":[{"value":"reservas#grupolospasiegos.com","type":"work"}],"phoneNumbers":[{"value":"942 525 962","type":"Villa Pasiega"},{"value":"942 525 963","type":"workFax"}],"biographies":[{"value":"Hotel los Pasiegos - Grupoo los Pasiegos","contentType":"TEXT_PLAIN"}],"urls":[{"value":"http://grupolospasiegos.com/contacto/","type":"profile"}],"organizations":[{"type":"Other","name":"HOTEL VILLA PASIEGA","title":"RESERVA"}],"memberships":[{"contactGroupMembership":{"contactGroupResourceName":"contactGroups/199bb8970e07b6a8"}},{"contactGroupMembership":{"contactGroupResourceName":"contactGroups/55fdbf598e048c03"}},{"contactGroupMembership":{"contactGroupResourceName":"contactGroups/5ee644148f02b901"}}]}',
responseType: 'json'
},
code: 429,
errors: [
{
message: 'Resource has been exhausted (e.g. check quota).',
domain: 'global',
reason: 'rateLimitExceeded'
}
]
}
The image below you can see my developer google console and it shows that i only have used 25 createContact request in a period of 2 days with a 100% error message which is the message a post here.
image
By the way thanks for your help.
I have found the solution to the problem and I have to be a bit extensive when explaining the solution.
Each google user has a limit on the number of contacts that can be stored in his contacts.google.com account, the limit is 25,000 contacts, if you exceed this limit the error shown in People API is 429 = Too Many Requests, my user only has 9000 contacts so the limit was not the cause of the problem, but what it had not considered is that a few weeks ago Google added a buttom basket for deleted contacts to contacts.google.com and it looks like that each contact deleted is stored and counted as a contact within contacts.google.com. This is what happened to me.
In summary:
My user has 9,000 visible contacts and 16,000 deleted contacts giving a total of 25,000 contacts causing error 429 to be displayed every time I try to create a new contact.
Solution:
Delete all deleted contacts, and everything should be resolved.
Hope:
Google allows access to People API to the contacts in the deleted basket and that error 429 better explains what it refers to cuz as i see in this case it is not a quota problem.
Important:
Thank you very much to #ale13 for your intent to help, I will leave this here in case future developers face the same problem.

aws boto3 paginator of list_images

can someone please help me understand and do paginator codehere in this list_images code:
When i run this to get list of images for ec2imagebuilder, in the responce i got the nexttoken so how to use this to list all images in next page/until end.
client = boto3.client('imagebuilder')
response = client.list_images(owner='Amazon')
print(response)
Response (Trucated result):
{'ResponseMetadata': {'RequestId': 'f4b9e178-b959-4e23-be57-0c234fbec69d', 'HTTPStatusCode': 200, 'HTTPHeaders': {'date': 'Sun, 10 May 2020 21:53:55 GMT', 'content-type': 'application/json', 'content-length': '8709', 'connection': 'keep-alive', 'x-amzn-requestid': 'f4b9e178-b959-4e23-be57-0c234fbec69d', 'x-amz-apigw-id': 'MVet5Hp0PHcFeaw=', 'x-amzn-trace-id': 'Root=1-5eb877f2-9bec8ecc200f1394f6b0d340;Sampled=1'}, 'RetryAttempts': 0}, 'requestId': 'f4b9e178-b959-4e23-be57-0c234fbec69d', 'imageVersionList': [{'arn': 'arn:aws:imagebuilder:us-west-2:aws:image/amazon-linux-2-x86/2019.11.21', 'name': 'Amazon Linux 2 x86', 'version': '2019.11.21', 'platform': 'Linux', 'owner': 'Amazon', 'dateCreated': '2019-11-30T07:37:51.495Z'}, {'arn': 'arn:aws:imagebuilder:us-west-2:aws:image/windows-server-2012-r2-rtm-english-core-x86/2019.11.19', 'name': 'Windows Server 2012 R2 RTM English Core x86', 'version': '2019.11.19', 'platform': 'Windows', 'owner': 'Amazon', 'dateCreated': '2019-11-30T07:38:07.177Z'}], 'nextToken': 'eyxxxMS4xOSIsICJBY2NvdW50SWQiOiAiNTgwMDg3NjIzMDA1In0sICJtYXhfcmVzdWx0cyI6IDI1LCAia2V5X2NvbmRpdGlvbnMiOiB7IkFjY291bnRJZCI6IHsiQXR0cmlidXRlVmFsdWVMaXN0IjogWyI1ODAwODc2MjMwdddiOiBmYWxzZSwgInNjYW5faW5kZXhfZm9yd2FyZCI6IHRydWUsICJleHBpcmF0aW9uX2RhdGUiOiAxNTg5MjM0MDM1fQ=='}
Based on the documentation, you can use the following code snippet to list all images owned by Amazon.
client = boto3.client('imagebuilder')
response = client.list_images(owner='Amazon')
print(response['imageVersionList'])
while 'nextToken' in response:
response = client.list_images(owner='Amazon', nextToken=response['nextToken'])
print(response['imageVersionList'])

Google Datalab is not working now

The easy-and-famous datalab create instance-name command is not longer working. We did not any change in project/apis/keys/ or any other google options.
The same cmd was ok yesterday and now:
user-used-yeserday#pruebaalexborrar:~$ datalab create alexborrarpurbea
ERROR: gcloud crashed (BadStatusCodeError): HttpError accessing
<https://sourcerepo.googleapis.com/v1/projects/pruebaalexborrar/repos
alt=json>:
response: <{'status': '500', 'content-length': '109', 'x-xss-protection':
'1; mod
e=block', 'x-content-type-options': 'nosniff', 'transfer-encoding':
'chunked', 'vary': 'Origin, X-Origin, Referer', 'server': 'ESF', '-content-
encoding': 'gzip', 'cache-control': 'private', 'date': 'Wed, 19 Apr 2017
09:08:43 G
MT', 'x-frame-options': 'SAMEORIGIN', 'content-type': 'application/json;
charset=UTF-8'}>, content <{
"error": {
"code": 500,
"message": "Internal error encountered.",
"status": "INTERNAL"
}
}
>
When I use the same URL on my browser to get the error, I got other different error:
{
"error": {
"code": 401,
"message": "Request is missing required authentication credential. Expected
OAuth 2 access token, login cookie or other valid authentication credential.
See https://developers.google.com/identity/sign-in/web/devconsole-project.",
"status": "UNAUTHENTICATED"
}
}
I guess the 401 error code is not related with the upper 501 from the `datalab create´ command...
I know google now is deploying new cloud release...
Anyone knows what's happening?
There is a reported issue as #37242989 at the issue tracker regarding this, so I suggest that you can add more details and star the issue there to get further updates from the related team working on this.