What Metrics are available for AWS SNS through AWS SDK Metrics? - aws-sdk

What Metrics are available for AWS SNS through AWS SDK Metrics?
I've enabled it like this (scala code):
AwsSdkMetrics.addAll(Arrays.asList(AWSRequestMetrics.Field.values : _*))
AwsSdkMetrics.addAll(Arrays.asList(AWSServiceMetrics.values : _*))
I see AmazonDynamoDB and AmazonFirehose metrics, but nothing related to SNS.
What other MetricType's am I missing to publishing any interesting SNS metrics? Ideally, I could see metrics like latency, connection timeouts, request timeouts, number of retries, etc.

I reached out to AWS support and as of 09/14/2020, "SNS does not have its own client side metrics. SNS only support metrics at the server side "

Related

How to publish AWS SNS data to MySql database

I am new to AWS/Database.
Since i am completely beginner to this, any suggestions will be appreciated.
Currently in the project it has been planned like data from AWS database will be pushed using SNS HTTP fanout to external MySql Database.
NOTE :
1.The data will be pushed by the Client using AWS SNS
2. We have no access to the AWS account nor we are planning to have a AWS account.
3. External MySql database is a private database running on Linux Server
I have gone through the Official documentation of AWS SNS, and also some websites. This is all i found :
Use external applications like Zapier to map the data.
Develop some application to map the data.
Is it like using a Servlet application in the receiver side to update the table, or is there any other methods?
AWS DB -----> SNS -----> _________ -----> External MySql DB
Thanks
If you cannot have an AWS Account, you can have your own web server consume the SNS Messages. SNS can deliver messages to an HTTP/HTTPS endpoint in a predefined structure. Read more details here. You can enable such an endpoint on your own server and share your server URL with the AWS Account owner. They can create a subscription from their SNS topic to your endpoint.
For setting up this endpoint, there are many options. ExpressJS is one such popular framework to quickly implement HTTP APIs.
Probably, option two would be more suited, or at least first to be considered. For that option you would have have to develop a lambda function which would receive data from SNS, re-format if needed and upload it to MySQL. So your architecture would look like:
Data--->SNS--->Lambda function---> MySQL
Depending on the amount of incoming data to the SNS, you may add SQS queue as well to the mix, to buffer the records and enable fun-out architecture. For example:
/---> SQS queue 1---> Lambda function 1---> MySQL
Data -->SNS --/
\
\--- SQS queue 2 ---> Lambda function 2, EC2 instance, Container ---> Other destination
Other solutions are possible. But I would first consider the above, before looking into other ways.

Share state across Google Cloud Functions

I have a Google Cloud Function that I want to return the same value to all clients calling it. The value is set by another Google Cloud Function. I have this working using Firestore, but I want something that can store the value in memory or push the value change into an event queue.
If you look for in memory and low latency data storage, you can have a look to memorystore service. It's based on Redis product and can serve you data in key-value access mode at low latency.
Memorystore is only available with a private IP in your VPC. For this, you can plug a serverless VPC Connector to your functions (who write and who read) to allow them to access to your VPC and thus to access to Memorystore service.
Take care to create your functions, your serverless VPC Connector and your Memorystore in the same region to improve the latency.
If it doesn't work, have a look to your firewall rules and allow the Redis traffic port (6379)

AWS SQS to receive message from outside of AWS

my company has a messaging system which sends real-time messages in JSON format, and it's not built on AWS, and will not have any VPN connection with AWS.
our team is trying to use AWS SQS to receive these messages, which will then have DynamoDB process JSON messages to TSV, then load into RDS.
however, as per the FAQ, SQS can only receive message from within AWS.
https://aws.amazon.com/sqs/faqs/
Q: Who can perform operations on a message queue?
Only an AWS account owner (or an AWS account that the account owner has delegated rights to can perform operations on an Amazon SQS message queue.
In order to use SQS, one way I can think of is to create a public-facing EC2 instance, which receives messages and passes over to SQS.
My questions here are:
is my idea correct?
if it's correct, can you share any details on how to build any applications on this EC2 instance to achieve the functionality (I have no experience on application development, your insights are really appreciated!)
is there any easier/better options in AWS that can achieve the goal to receive message in my use case?
is my idea correct?
No, it isn't.
You're misinterpreting the (admittedly somewhat unclear) information in the FAQ.
SQS is accessible and usable from anywhere on the Internet. Its only exposed interface is HTTP(S). In fact, from inside EC2, SQS is not accessible unless the EC2 instance actually has outbound access to the Internet.
The point being made in the documentation is not that you need to be "inside" AWS to use queues, but rather that you need to be in possession of an authorized set of AWS credentials in order to work with queues.¹
If you have an AWS account, you have credentials, and you can use SQS. There is no requirement that you access the queue from "inside" AWS.
Choose the endpoint closest to your servers (for lowest latency) and you should find it open and accessible, from anywhere.
¹Queues can be configured to allow anonymous acccess after they are created. (Don't do it, I'm just saying it is possible.) This section of the FAQ seems to be referring to a subset of operations, such as creating queues.
I was not able to write to SQS from an external service. I found some partial explanations but got stuck at the role creation.
The alternative I found is using AWS services Lambda + API Gateway to write to SQS.
This tutorial was extremely helpful, explaining all the steps in great details:
https://startupnextdoor.com/adding-to-sqs-queue-using-aws-lambda-and-a-serverless-api-endpoint/
You can access sqs from anywhere once you have proper permission through accesskey&secret key or IAM role.
SQS is not specific to vpc
It is clear that you try to do this :
Take message from your company messaging system, send it to SQS.
It is not wrong using your method (using EC2 as a bridge). However, you don't need EC2 to connect to SQS.
All AWS services can be access using AWS API(e.g. Python boto3, etc) from internet, as long as you provide the correct credential. So you can put your "middleware" in anywhere as long as you are able establish connection to the said services.
So there is lots of more options available to you. e.g. trigger from your messaging system; use AWS Lambda, etc.
Thanks for sharing the information and your insights with me!
I have tested below solution, which works for my use case:
created an endpoint in AWS API Gateway, which is able to receive messages from company messaging system, a system that does not carry AWS credentials
created a Lambda function triggered by API Gateway, so once a message arrives, Lambda will digest the JSON message and convert it to TSV, and then load into RDS

Get Memory and Cpu Usages in Google Cloud Compute

How is one supposed to access the CPU usages and Memory usages of all the instances in a given project in Google Cloud Compute?
I'm unable to find anything regarding this in the documentation.
You can use Google Cloud Monitoring to see some usage metrics for your systems, and the Google Cloud Monitoring agent to get more precise metrics like memory. See the GCP metrics documentation for a list of all available compute metrics.
For memory usage on Debian:
free -m
in console.
You can CPU, Memory, Network, Disk I/O related information of your instance group into Google Stackdriver. Stackdriver comes with a separate subscription. You can add charts to monitoring your GCP infrastructure into one single/multiple dashboard/s.
You can see detail information in How to monitor GCP infrastructure using stack driver visualization
if you are using Linux, you can install gnome-system-monitor and ssh -X into the system and launch it.
For Ubuntu on GCP:
"apt-get install gnome-system-monitor dbus"
From another linux machine (or if you have cygwin/x installed on windows), just "ssh -X {remote ip}" Then type gnome-system-monitor and it will launch on your desktop.
You could also setup a vncserver on the cloud platform.

Google Cloud SQL monitoring

I am wondering what are the current/existing possibilities of monitoring mysql instances on Google Cloud SQL? What I need is:
define alerts and trigger actions (send via http) for set of mysql metrics
retrive metrics via http
There is not much I see in Google Cloud SQL dashboard for my mysql instance. When I go to Monitoring -> Dashboard & alerts I see that it is disabled due to Stackdriver migration. Am I doing something wrong here or what I want/looking for is not possible at the moment?
Although the dashboard & alerts are not yet available, there is an API to access monitoring statistics: Cloud Monitoring. You would need to build your own alerting/trigger system on top of this at the moment.