Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.

Sistergodiva posted:

I am having a horrible time trying to get websockets to work on elastic beanstalk.

My setup is cloudfronted s3 bucket with static react page ---> nodejs websocket server ---- > java backend

No matter how I try I can't seem to get websockets working behind a application loadbalancer.

I want to have the nodejs backend available from the web, but connected to the java backend which is on a vpc.

I managed to get it working before, but that was without a working healthcheck and socket.io stuck in polling mode.

Now I can't even recreate that it seems.

Has anyone used websockets with elb before and got it to work?

Edit: The closest I have managed to get is the frontend giving a 502 Bad Gateway, with no logs in the node elb.

How flexible are you with the implementation details? Have you looked at the new API Gateway support for WebSocket?

Adbot
ADBOT LOVES YOU

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.

Soaring Kestrel posted:

Hello! I am trying to build a DynamoDB table and am getting a little bit confused. I've been reading a lot of the documentation but I'm still not 100% clear, since this is my first time actually using DynamoDB. It is a pretty simple use case so mostly I am asking for a sanity check if what I am putting together makes sense.

Basically, I need to store blog comments with threading at depth 1. These will then be retrieved and displayed using the following basic workflow: "grab all the comments with a "post_uid" field matching a condition, then grab the comments with a "parent" field matching the id of each of the comments retrieved in the first query".

Does the following make sense?

- One table for root comments; partition key of "post_uid" field, with "ts" as the sort key
- One table for child comments; partition key of "parent" field, with "ts" as the sort key

Is there a better way I could build this out? Does it make more sense to just use one table and global secondary indexes for everything - or is this about the best I could do?

I am attempting to avoid using RDS for this because based on my projected query and data volumes, I expect costs to be exponentially lower using DynamoDB.

Some questions:

1. "grab all the comments with a "post_uid" field matching a condition" - is "post_uid" the unique id for the associated blog post? What is the condition that needs to be matched? Equality?
1. Where are the blog posts themselves stored? How big are they?
2. How many comments can be made on one blog post? How big are the comments?
3. I assume "ts" = timestamp, how are you using this?

It sounds like you're wanting do some fancy queries, which is outside DDB's capabilities and sweet spot. It seems to me your use case is "grab everything associated with a given blog post", which DDB is very good at. You can definitely do this with one table and without a GSI. Adding either of those would add a lot of complexity and downsides and I don't see any benefits to justify it.

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.

Soaring Kestrel posted:

Ugh yeah rereading there was some confusion there.

- post_uid matches your assumptions.
- Posts are stored in S3, and a static site generator is creating UID's for them when they get posted. Those UID's get passed as part of an AJAX POST to a Lambda function when adding comments. They don't exist in the database in any other way.
- No limit on number, there is a character limit on text length (1000 for now).
- Timestamp used for sorting: parents sorted by timestamp descending, then children sorted ascending for each parent.

I was kind of shooting in the dark on the two-tables thing. I modeled it on the "thread" and "reply" tables that are used in one of the DDB examples in the documentation.

With no limit on the number, you'll have to store comments as separate records in your table (the reason I asked is if your limit/size is low enough it could be feasible to store them all in one record for the post). Based on what you're written so far, I would use post_uid as partition key, and then a combination of parent comment id (0 = top level comment), timestamp, and comment id (in case two people post comments at the same time) for the sort key:


postId(partition key)-------------------sortKey(sort key)
--------------------------------------------------------------------
075fd5b5-5029-4ee0-b456-eac9b989e2c0----0:2019-06-06T18:12:31+00:00:1
075fd5b5-5029-4ee0-b456-eac9b989e2c0----0:2019-06-06T18:12:42+00:00:2
075fd5b5-5029-4ee0-b456-eac9b989e2c0----0:2019-06-07T18:11:54+00:00:3
075fd5b5-5029-4ee0-b456-eac9b989e2c0----1:2019-06-08T18:15:41+00:00:4
075fd5b5-5029-4ee0-b456-eac9b989e2c0----3:2019-06-09T18:16:18+00:00:5
...


You should still store the constituent parts of the sort key as separate fields (good practice).

You can then use a query with a string-based key condition on the sort key to find only top-level comments, and sort it descending (ScanIndexForward=false).

Then to tie comments to their parents you can either do separate queries for each top-level comment (begins_with on the sort key), or just do a single second query to find replies and their parent ids with an ascending sort order, and match them up in-memory. It's a trade-off between performance and and Lambda compute cost.

You'll also need to deal with paginating comments and cleaning up comments once the post itself is deleted (if that happens). Ideally the post itself would be stored in the same DDB table (with a spillover to S3 if necessary).

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.

PierreTheMime posted:

Continuing on my adventures in S3, what's the preferred method for unzipping large files when they land in a space? I already have the code ready to extract it via Lambda/Java which works, but a coworker has it in his mind he'd prefer invoking an unzip from an Docker-spawned EC2 which seems a little much to me.

What do you mean by “when they land in a space”?

“Docker-spawned EC2” doesn’t make sense to me and sounds more complicated than using Lambda.

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.

PierreTheMime posted:

I mean when a file is uploaded to the S3 bucket. I phrased it that way because I plan to control whether the unzip happens based on a folder metadata value similar to what I have for the movement function.

I haven’t gotten them to elaborate on what they intended to do exactly. Their whole thing was “Lamdba is limited to 512MB so obviously we can’t unzip 513MB+ files”. Having worked with the S3 streams earlier I knew it was pretty simple but I didn’t know if there were pitfalls to consider or an accepted standard beside writing your own code.

Your coworker is an idiot. Lambda’s memory limit can go up to 3GB, but even if the 512MB were true, you can unzip any size file if you do it in a streaming way.

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.

Arzakon posted:

Co-worker is an idiot but there is only 512mb of scratch space in tmp on each function invocation.

True, but from what PierreTheMime has said that’s still not a problem. What’s supposed to happen after the unzip?

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.
For future reference, you should turn on logging for both APIG and Lambda and check the appropriate CloudWatch logs.

The first invocation after saving the function will always be a cold start, so the symptoms you were seeing definitely pointed towards something being not quite stateless.

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.
Yep that’s spot on. In fact this is what we do internally at AWS. Using IAM users is strongly discouraged and there is a lot of work ongoing to get rid of existing ones.

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.
Are you looking for something like Step Functions? If not, can you give a more specific example of what you’re trying to do?

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.

Cancelbot posted:

I loving got it! :woop: I'll be a Senior TAM in 2 months (notice period boo).

Congrats! :toot:

What org will you be in?

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.
You want to Google for availability SLAs (not failure rates). Here are AWS' own SLAs for availability: https://aws.amazon.com/legal/service-level-agreements/.

Your availability is currently 99.9% (100 - 0.1), which is not great, not terrible. At AWS, that's where we start paying our customers credits for most services. Your advertised SLA is apparently 98.5% (100 - 1.5), which is pretty terrible. I wouldn't want to use such a service personally. Seems like you could make a stronger promise there.

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.

Agrikk posted:

Be careful how you book sessions. If you are sloppy you can walk ten miles in a single day, like a customer did.

New service: AWS Exercise.

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.

a hot gujju bhabhi posted:

Vent time.

I hate these weird gaps in functionality that AWS has, for no discernible reason and with no documentation available to explain the problem. In this case I'm trying to shift some of our current Azure poo poo over to AWS and wanted to set up our CICD stuff in the AWS tooling, Code Build, Deploy and Pipeline. Already I got stuck at the very first step because Windows is mysteriously missing from the dropdown list of build container environments. I Google and Google, and I look through all the AWS docs and they all say the same thing "Select Windows from the dropdown". Finally I try doing the same thing using a JSON file and the CLI tool and lo and behold I finally get a useful message. For some reason the Windows container environment is not available in ap-southeast-2. This is not mentioned anywhere in their documentation. Anyway, I Google this and see someone has asked about it and AWS's response is "we have no current plans to do this". This is so frustrating...

On a related note: does anyone know of a way to build a .NET Framework project in a non-Windows environment? I've heard about Mono but I'm not sure how that works exactly, do you have to modify the project itself to get it to build with Mono? Is there some straightforward reading I can use to give me a fairly generalised understanding of the relationship between Mono and regular .NET Framework build options?

Please also vent on the feedback forms, there should be feedback links on every doc page. I totally agree our docs are poo poo.

As for your .NET question, you could look into .NET Core, if your project builds on it. It runs on Linux too.

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.
:hfive:

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.

a hot gujju bhabhi posted:

Sorry for a pretty newbie question, but I'm looking at this: https://docs.aws.amazon.com/codedeploy/latest/userguide/reference-appspec-file-structure-hooks.html

I'm setting up a CodeDeploy application to deploy to EC2 instances and I'd like to us the Blue/Green approach. I want to use original instances (not replacement instances), so I'm looking at the table showing available lifecycle hooks and it seems like I can only assign scripts to these two:

  • BeforeBlockTraffic
  • AfterBlockTraffic

Is this correct? If so, why? Is there a technical limitation as to why I can't attach scripts to - for example - the AfterInstall hook?

Not sure if I understand the question right; the three steps in the table are the only ones that happen for the original instances. There is no installation happening on them.

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.

dividertabs posted:

DynamoDB on-demand pricing. They don't tell you this in their documentation* but it still throttles. It appears to just be a wrapper hiding Dynamo's autoscaling feature plus a different billing scheme.

*To rant, this kind of marketing- instead of technical- focused documentation is the main reason I roll my eyes every time I hear someone in AWS mention "customer obsession"

Mildly triggered AWS engineer here (not from the DDB team). Can you provide more detail on the circumstance under which you got throttled from your on demand table? It may throttle for a short time before it scales up, but once scaled it should subsequently be able to handle the same load in the future. You can shortcut the initial throttling by setting an appropriate provisioned capacity on the table before switching it to on demand.

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.

Nomnom Cookie posted:

Athena is managed presto and totally unsuitable for anything.

Fixed.

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.

dividertabs posted:

Say we want to scale from 0 to 1,000,000 reads/sec in 1 second. S3 can do it (with good P95 latency, and poor p99 latency). It was not surprising to me that Dynamo couldn't do it. It was surprising to me that Dynamo couldn't do it, and the documentation for Dynamo on-demand, which emphasizes that it 'instantly accommodates customers’ workloads as they ramp up or down', didn't mention it. Bolding my own. No judgment on whether my ideal behavior is reasonable.

It should only throttle the first time you scale up that table though. Never if you use the shortcut I mentioned. See also: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadWriteCapacityMode.html#HowItWorks.InitialThroughput

I agree our docs are generally poor.

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.
From the link you posted:

quote:

This topic explains authenticating requests using Signature Version 2. Amazon S3 now supports the latest Signature Version 4. This latest signature version is supported in all regions and any new regions after January 30, 2014 will support only Signature Version 4. For more information, go to Authenticating Requests (AWS Signature Version 4) in the Amazon Simple Storage Service API Reference.

Make sure you're implementing SigV4, not SigV2, which is ancient. Read this: https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.
This library contains the official AWS C implementation for SigV4 signing: https://github.com/awslabs/aws-c-auth. It’s Apache 2 licensed.

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.

PierreTheMime posted:

What’s the best deployment mechanism for a Step Functions state machine and underlying resources? Lambda, Batch are primary services, but presumably we’d also want associated IAM roles, DynamoDB table, SSM parameter store, secrets, etc.

Right now we have a ton of people tossing a project together and it’s working fine but every time someone asks the best repo/deployment method for it everyone just shrugs.

What are you using now? CloudFormation will let you manage all that infrastructure.

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.
Is this interview at AWS, or a company using AWS? If it’s at AWS, avoid using a relational databases. I would recommend that in either case actually, but we really don’t like relational databases at AWS and this is definitely in DynamoDB’s sweet spot.

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.

Hughmoris posted:

Side note: seems like prime opportunity for a good tutorial here. Amazon Training walks you through all this via the console UI but it would be great to then have the same steps via Terraform. If I can complete this then I might try a Terraform write-up.

Because Terraform is a competing product. CDK is what we want customers to use. Should be able to find tutorials for it.

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.
Internally at AWS we often use Step Functions state machines to implement asynchronous API operations.

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.

Tulenian posted:

Huh I figured the folks doing it would bias towards simple workflow service instead.

Also sad I just thought to read this thread as my last day at AWS was Friday.

SWF is also used a lot in more old school teams. I’m all about that serverless life though.

I’m probably leaving soon too…

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.
Money.

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.

Scrapez posted:

Does AWS not pay well or just typical have to move to a different company to get a big bump in $$?

I was going to effort post but it’s already been explained pretty well in the last few posts. I joined in 2016 so my cliff was 2020. My compensation for 2022 has dropped 40% compared to 2020.

I’m way below the range for my role and the correction for that is way too slow. So I don’t really have a choice. I like my job but can’t afford to stay.

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.
After 6 years at AWS I can assure you that even there, most engineers only vaguely know HTTP, and anything below that might as well be magic.

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.
In a stunning display of Bias for Action and Insists on the Highest Standards, I quit my job at AWS last week.

But yes, having a solid story for each leadership principle will help enormously in getting the job because every candidate is directly scored on how they performed on each one during interviews.

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.

Agrikk posted:

Congratulations! And you left as the stock lost a third its value so double well done!

Double thanks!

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.
And that reason is bucket sniping.

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.
It’s a bit more nuanced than that, but pretty much, yeah. There are also more steps between EC2 and Lambda (ECS on Fargate, ECS on EC2).

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.
I’m very happy I left AWS in July and now work for a private company. So nice to not have to follow the stock market so closely. Found out recently my last manager also left, and he was largely keeping things afloat in my org.

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.

jiffypop45 posted:

Bots required manual approval via a team that had like 5 people and there was no process in place for that or many other things. There was no way to join private channels without being added by hand. FC/contract employees were unable to use slack. Emojis gave people with epilepsy seizures at least twice due to bad internal actors. Amazon tried to make retention two weeks likely to cover something up only to brown out slack globally when they rolled it back after hiding whatever they sought out to hide.

Plenty more but those are what I can think of offhand.

:party_parrot:

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.
CDK for life.

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.
Do you need SF here? Sounds like a perfect use case for SQS + DLQ with a Lambda trigger off the queue. Then you get the redrive functionality for free.

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.
I would go S3 -> SNS -> SQS -> Lambda.

Adding SNS is optional but provides decoupling and allows you to do add some other processing later if you want.

SQS (with DLQ) gives you great error recovery and let’s you absorb bursts nicely.

Adbot
ADBOT LOVES YOU

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.
2 and 3 are the standard two you would use at a minimum and very widely used. Depending on how you are receiving from the queue, you could additionally look at the number of empty receives. If that goes up you are probably overscaled. Ideally your receiving side is autoscaled though (i.e., use Lambda). Generally though, for alerting, the ones you already have are great. Beyond that I just look at the metric page in the console for the queue as needed.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply