AWS Connect - How to automate outbound call? - amazon-web-services

I am able to make manual calls to my customers. However, if I want to send an automated message to these customers the previous night, is it possible? What could be the possible steps:
The customer information can be stored in a DynamoDB table.
I can create a contact flow: Start, Call Phone no, Set Voice, Play Prompt, End flow
If the flow is correct then which block will make the db/Lambda call? (Is it play prompt?)
I tried using StartOutboundVoice but if the contact flow is Outbound Whisper then it does not work.
Really appreciate some help.

TLDR: create a lambda to call the StartOutboundVoiceContact API action
Here are two guides from AWS which I found quite useful
Automating outbound calling to customers using Amazon Connect
Creating an outbound calling solution during a pandemic using Amazon Connect
The authors go through a couple of use-cases which you may find relevant.

Related

GCP Cloud Data transfer - any notifications?

I want to build a small solution that will transfer files from Azure to GCP. The solution itself works fine, but I don't see any solution anywhere that could inform me that the transfer started, ended or there was an error (e.g. on Slack). I can't see anything in the logs that could help me. I tried to do it with PUB/SUB but without any luck.
Is there any easy way to connect Data Transfer with slack or e-mail?
Thx
At this point in time, the Cloud Data transfer service has no way to send notifications(mail/slack/etc), you could try to implement something by monitoring the logs of the GCS bucket.
In the case you are mentioning, you could be monitoring the logs of GCS looking for writes, and send a notification based on that, nevertheless, it would take some fine tuning on your side.
I would also recommend to create a feature request here so that Google knows that this feature is needed and they themselves implement it in the future.
I am part of Storage Transfer Service team. We offer a to get notified via pubsub of the state of the transfer job. It's an API only feature at this time. Check out here.

Can You Trigger a Cloud Function In Response to Increased Traffic to Your Website?

Is there a way for me to run a cloud function to update some data whenever there is lots of activity to one of my pages? sorry if this is a stupid question.
Cloud Functions does not have any triggers that automatically respond to the load on a web site. You will have to find some other way to gauge that traffic, and then perhaps invoke an HTTP trigger directly.
If you want to see the complete list of trigger types, see the documentation.
as far as I know there is no such thing as a direct trigger between a spike of events in service A and cloud function (unless the service A is itself a cloud function, that would indeed scale).
However it exists second party trigger with stackdriver that allows you to define rules that once hit would deliver an event to a pub/sub topic that a cloud function of your choice can suscribe to. Be cautious with what you intend to do with your cloud function, you may have concurency issues depending the technology of the database you want to modify. In other word, try to be as idempotent as possible.
I think you may be interested by this community tutorial.

How to monitor entire AWS environment?

I am looking for a way to monitor any changes that occur to my production envrionment. Such as security group changes, ec2 create/stop/deletes, database changes, s3 bucket changes, route table changes, subnet changes, etc... I was looking at using cloudtrail for this and monitoring all api calls. However, when testing, my subscribed SNS topic was not receiving any notifications when i was making some changes for a test. Curious if anyone else has a work around for this or if I am missing something? Maybe lambda? Just looking for the easiest way to receive email notifications when any changes are made within my prod environment. Thank you.
If you're looking to audit the entire event history of AWS API calls then you would use CloudTrail, remembering to create a trail and enabling the options if you want to audit S3 or Lambda API calls.
By itself CloudTrail will provide auditing, but it can be combined with CloudWatch/EventBridge to automate actions based on specific API calls such as triggering a Lambda or triggering an SNS topic.
Regarding your own implementation so far using SNS always ensure you've accepted the subscription first on the subscriber(s).
In addition you can use AWS Config with many resources in AWS providing 2 benefits to you. You will be able to maintain a history of changes to you resources, whilst also being able to configure compliance and resolution rules for your resources.

How would I create a Minecraft EC2 server that automaticaly starts when someone tries to use it

Currently, I have a working modded Minecraft server working running on a C5 EC2 instance. The problem is that I have to manually start and stop the server which can be annoying for my friends. I was wondering if it would be possible to automate the EC2 state so that it runs as soon as a player attempts to join the sever. This would be similar to how Minecraft realms behaves which I heard Mojang was using AWS for:
https://aws.amazon.com/blogs/aws/hosting-minecraft-realms-on-aws/
I have looked up tutorials for this and this is the best I could come across:
https://github.com/trevor-laher/OnDemandMinecraft
The problem with this solution is that it requires to make a separate website to log users in and start the EC2 instance while I want the startup and shutdown to be completely automatic.
I would appreciate any guidance.
If the server is off, it would not be possible to "connect" to the server. Therefore, another mechanism is required that can be used to start the server.
Combine that with your desire to minimise costs and the only real solution is to somehow trigger an AWS Lambda function, which could start the server.
There are a few ways you could have users trigger the AWS Lambda function:
Make a call to API Gateway
Upload an object to Amazon S3
Somehow put a message in an SNS topic or an SQS queue
Trigger an Amazon CloudWatch Alarm (which calls Lambda via SNS)
...and probably other ways
When considering a method to use, you should consider security implications such as:
Whether only authorized users should be able to trigger the Lambda function, or is it okay that anybody (eg a web crawler) might trigger it.
Whether you willing to give your friends AWS credentials (not a good idea) that they could use to start the server directly, or whether it should be an indirect method.
Frankly, I would recommend the following architecture:
Create an AWS Lambda function that turns on the server
Create an API Gateway that triggers the Lambda function
Give a URL to your friends that calls the API Gateway and passes a 'secret' (effectively a password)
The API Gateway will call the Lambda function, passing the secret
The Lambda function confirms that the secret is correct and starts the Amazon EC2 instance with Minecraft installed
Here is a tutorial that shows many of these concepts: Build an API Gateway API with Lambda Integration
The purpose of the secret is to avoid the server from starting if an unauthorized person (or a bot) happens to hit the API Gateway endpoint. They will not provide the secret, so the server will not be started.
Stopping the server after a period of non-use is a different matter. The library you referenced might be able to assist with finding a way to do this. You could have a script running on the Minecraft server that monitors the game and, after a period of inactivity, simply calls the operating system to perform a Shutdown.
You could use a BungeeCord hub server that then allows user to begin a connection to the main server and spin it up via. AWS.
This would require the bungee server to be always up however, but the cost of hosting a small bungee server should be relatively cheap.
I don't think there's any way you could do this without having a small server that receives the initial request to spin up the AWS machine.

Is amazon lambda suitable for web scraping?

If I create a function to get webpages. Will it execute it on different IP per execution so that my scraping requests dont get blocked?
I would use this AWS pipeline:
Where at source on the left you will have an EC2 instance with JAUNT which then feeds the URLS or HTML pages into a Kinesis Stream. The Lambda will do your HTML parsing and via Firehose stuff everything into S3 or Redshift.
The JAUNT can run via a standard WebProxy service with a rotating IP.
Yes, lambda by default executes with random IPs. You can trigger it using things like event bridge so you can have a schedule to execute the script every hour or similar. Others can possibly recommend using API Gateway, however, it is highly insecure to expose API endpoints available for anyone to trigger. So you have to write additional logic to protect it either by hard coded headers or say oauth.
AWS Lambda doesn't have a fixed IP source as mentioned here
however, I guess this will happen when it gets cooled down, not during the same invocation.
Your internal private IP address isn't what is seen by the web server, it's the public ip address from AWS. As long as you are setting the headers and signaling to the webserver that your application is a bot. See this link for some best practices on creating a web scrapper:
https://www.blog.datahut.co/post/web-scraping-best-practices-tips
Just be respectful of how much data you pull and how often is the main thing in my opinion.
Lambda is triggered when a file is placed in S3, or data is being added to Kinesis or DynamoDB. That is often backwards of what a web scraper needs, though certainly things like S3 could perform as a queue/job runner.
Scraping on different IPs? Certainly lambda is deployed on many machines, though that doesn't actually help you, since you can't control the machines or their IP.