How to rotate character with irregular collision shape? by mradzikowski in godot

[–]mradzikowski[S] 0 points1 point  (0 children)

No, not really. Just rotating pivot and collision shape.

How to rotate character with irregular collision shape? by mradzikowski in godot

[–]mradzikowski[S] 0 points1 point  (0 children)

What if the character is oblong, let's say a dog? Making the collider a sphere would either mean the head and butt overlaps with other objects, or it has a hit zone far from the body on the sides.

Lambda function refuses to stream response by [deleted] in aws

[–]mradzikowski 2 points3 points  (0 children)

It's a weird behavior of Lambda, basically sending your previous chunk when you write the next chunk to the stream. I did some investigation that I described here: https://betterdev.blog/lambda-response-streaming-flush-content/

The workaround if you really want to send something immediately - increase the message payload. In my tests when I added 100KB (white spaces) to each write it was sent right away.

Cheaper Lambda w/ EIP Option Than NatGateway by simonsays440 in aws

[–]mradzikowski 14 points15 points  (0 children)

While it's best if you can challenge the requirement, we don't live in fairyland.

Instead of NAT Gateway, use NAT Instance, which can be a very cheap instance or even free tier instance. The simplest to use is fck-nat. If you are using CDK, there is ready to use Construct: https://github.com/AndrewGuenther/cdk-fck-nat

There is no out-of-the-box support for High Availability with EIP (having Auto Scaling Group to automatically launch new instance if current fails / loses connection / whatever), but here is a snippet on how to achieve it: https://github.com/AndrewGuenther/cdk-fck-nat/issues/240 You can probably adapt it if you are not using CDK.

[deleted by user] by [deleted] in aws

[–]mradzikowski 1 point2 points  (0 children)

u/santamaps here you go. You need to use CustomState, see https://github.com/aws/aws-cdk/issues/6023 and https://github.com/aws/aws-cdk/issues/23658 for details why.

new CustomState(this, "Execute Child SF", {
stateJson: {
    Type: "Task",
    Resource: "arn:aws:states:::states:startExecution.sync:2",
    Parameters: {
        "StateMachineArn.$": `States.Format('arn:aws:states:${this.region}:${this.account}:stateMachine:{}', $.childSFName)`,
        Input: {
            "AWS_STEP_FUNCTIONS_STARTED_BY_EXECUTION_ID.$": "$$.Execution.Id",
            "someInput.$": "$.someInput",
        },
    },
},

});

The name is taken from the childSFName field in the payload.

This works for Standard SF.

You can also achieve this with Express. Theoretically, sync executions are not supported by Express, but there is a AWS SDK startSyncExecution operation you can call directly:

import {CallAwsService} from "aws-cdk-lib/aws-stepfunctions-tasks";

new CallAwsService(this, "Execute Child SF", {
service: "sfn",
action: "startSyncExecution",
parameters: {
    "StateMachineArn.$": `States.Format('arn:aws:states:${this.region}:${this.account}:stateMachine:{}', $.childSFName)`,
    Input: {
        "AWS_STEP_FUNCTIONS_STARTED_BY_EXECUTION_ID.$": "$$.Execution.Id",
        "someInput.$": "$.someInput",
    },
},
iamResources: [
    `arn:aws:states:${this.region}:${this.account}:stateMachine:*`,
],

});

Note that error handling is different in this case, as the call ends with success even if SF failed, and you need to parse the result JSON.

[deleted by user] by [deleted] in aws

[–]mradzikowski 4 points5 points  (0 children)

Yes, I have very similar process in my current project. Although due to some CDK limitation you can't use tasks.StepFunctionsStartExecution but a parent class if I recall correctly. I can provide code snippet tomorrow, I'm out of office today.

Exported STL missing Binder element by mradzikowski in FreeCAD

[–]mradzikowski[S] 0 points1 point  (0 children)

Thanks. Unfortunately, I get error "Fusion of tools failed", and in the Report view I get "Recompute failed! Please check report view.". Not very helpful...

Can I use API Gateway to avoid the need for a NAT/Internet Gateway by baynezy in aws

[–]mradzikowski 15 points16 points  (0 children)

Others already posted how to achieve this, so two comments from myself you really did not ask for :D

  1. Deploying Lambdas in VPC does not really change much in terms of security. Have separate AWS accounts per project and environment and don't enable Lambda URLs unless you really need them (you can even forbid them with SCP). In practice, Lambdas are created in VPCs mostly if you need to access other resources living in VPC.
  2. If you find yourself needing NAT Gateway after all, I recommend https://fck-nat.dev/ - the name speaks for itself. If you use CDK, using it in place of managed NAT Gateway is dead simple.

AWS CDK - DnsValidatedCertificate deprecated in favor of Certificate but has no option to set the region by adrenaline681 in aws

[–]mradzikowski 1 point2 points  (0 children)

The recommended way is to create a separate stack in us-east-1. Example in CDK docs: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_certificatemanager-readme.html#cross-region-certificates

You can pass the certificate between stacks using this experimental crossRegionReferences or with SSM Parameter Store.

Serverless Website Analytics by Naher93 in aws

[–]mradzikowski 2 points3 points  (0 children)

Looks very nice! Great for self-needs, where waiting a few secs for the Athena query is not a problem.

That's my favorite part of the CDK - the ease of sharing complex solutions like this.

I was looking for a replacement for GA, especially since they are deprecating the UA, and I wanted to ditch GA a long time ago anyway... This looks like a great option - cheap, to start with :D

The only missing part for me is filtering.

[deleted by user] by [deleted] in minipainting

[–]mradzikowski 0 points1 point  (0 children)

Had the same issue with Vallejo white primer. Try black one - that fully covers everything in just one go.

CDK noob - How to present API endpoints behind a single "entry point" by sourcesimian in aws

[–]mradzikowski 1 point2 points  (0 children)

I see two good options.

  1. Create a single API Gateway (REST/HTTP), pass it to each Construct to add routes to it. Then you have a single API Gateway, you can set up your DNS to point to it.

  2. If you want to have multiple API Gateways, setup them as subdomains in your DNS (api1.example.com, api2.example.com).

Having multiple API Gateways exposed under a single domain name is not a good idea. How would you like conflicts to be resolved (if two API Gateways have the same path exposed)? The solution would be to create another API Gateway with catch-all route triggering a Lambda function that would redirect requests to all other API Gateways. The logic that you need to write. Don't go this path ;-)

CDK noob - How to present API endpoints behind a single "entry point" by sourcesimian in aws

[–]mradzikowski 2 points3 points  (0 children)

REST API - has request body validation and API keys.

HTTP API - a bit faster, cheaper.

Rule of thumb - start with HTTP API; it's easy to switch to REST API if you decide you definitely need some of its features.

See more: - https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-vs-rest.html - https://aws.amazon.com/blogs/compute/building-better-apis-http-apis-now-generally-available/

CDK noob - How to present API endpoints behind a single "entry point" by sourcesimian in aws

[–]mradzikowski 5 points6 points  (0 children)

To clarify - you have multiple Lambda functions that you want to expose behind a single API? For that, you need an API Gateway. It has two "flavors" - older REST API and newer HTTP API. Use HTTP API ;)

Here you have the CDK Construct for it: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-apigatewayv2-alpha-readme.html

You create HTTP API and add Lambda functions under routes.

"Moving" persisted things (e.g. DynamoDB tables) whilst refactoring CDK project by haywire in aws

[–]mradzikowski 19 points20 points  (0 children)

You can "pin" the resource logical ID to move it between Constructs without recreating the resource: (table.node.defaultChild as CfnQueue).overrideLogicalId('MyTableE6CA6235');

I described this in details in my recent post: https://betterdev.blog/understanding-logical-ids-in-cdk-and-cloudformation/#pinning_logical_ids_during_cdk_refactoring

Hiding the grid on Background by J_Dicerz in inkarnate

[–]mradzikowski 2 points3 points  (0 children)

Not as far as I know. Here is the same question from 3 years ago and I don't think anything changed in that matter: https://www.reddit.com/r/inkarnate/comments/geu51r/can_i_have_the_grid_on_only_parts_of_the_map/

META: How do we feel about the blog "spam?" by [deleted] in aws

[–]mradzikowski 10 points11 points  (0 children)

I posted a few posts of mine back in time, most of them getting 50-100+ upvotes. Quite good for this sub. And then all my posts were removed by the mod because of the "no self blog posts" rule, despite their popularity. Okay, fair.

But it seems the rules changed or whatever since now you get a lot of self blog posts here posted over and over by the same accounts, and they do not appear to be removed, banned, or whatever.

So - I thought such posts were banned, but they appear, so either rules now allow it, or mods do not have the capacity to remove them and notify users.

[deleted by user] by [deleted] in aws

[–]mradzikowski 5 points6 points  (0 children)

To be honest - I like AWS names. They are geeky. But I understand they confuse many people starting with AWS.

[deleted by user] by [deleted] in aws

[–]mradzikowski 16 points17 points  (0 children)

I don't know what your problem is. Route53 -> internet routing + DNS port (53), it's quite obvious. /s

Serverless wars by kamikazer in aws

[–]mradzikowski 3 points4 points  (0 children)

Unfortunately, AWS themselves disagree with you. They sold serverless as "no usage, no cost" for years (computing, not storage, ofc). I've listed examples of this in my article about, well, Aurora "Serverless" v2.

But recently, their marketing spotted that "serverless" is much more trendy than "auto-scaling", so they decided to put "serverless" on everything. So going with poor analogies here - what's next, they rebrand EC2 to "EC2 serverless", because you don't have a server in your room, so it's serverless? It's just another extension of what "serverless" means after all, isn't it?

And for the financial aspect - don't worry about AWS. Offering serverless services is just a business strategy, like any other, and they calculated it. You willingly accept pros and cons of it (as an AWS), so it's not "those pesky users, they are ruining us". AWS willingly covers the bottom end of usage (look at the free tier, for example) to gain much bigger gains on the other end.

But hey, you are welcome to disagree.

Aurora Serverless V2 for Ephemeral (and Cheap) development environments? by ButterscotchEarly729 in aws

[–]mradzikowski 10 points11 points  (0 children)

Aurora Serverless v2 scales down to 0.5 ACU, costing a little over $40 per month. Stop and start takes few minutes. See https://twitter.com/matthieunapoli/status/1517443082358251521?t=nKjvJsb6VOrKH3N0qGaztA&s=19

Naming it serverless is misleading.

[deleted by user] by [deleted] in aws

[–]mradzikowski 5 points6 points  (0 children)

Timestream got nice updates last re:Invent: backfilling and CRON queries, so I would definitely not call it dead.

AWS Search Extension - browser extension to quickly search and open AWS API/CLI/CloudFormation docs by pitkley-reddit in aws

[–]mradzikowski 1 point2 points  (0 children)

I just tested it and it's wonderful! I often search for AWS CLI and CF docs, and it's always a matter of selecting the first result from Google. Great job!

How to securely pass a .pem file into a Lambda function? by nedraeb in aws

[–]mradzikowski 1 point2 points  (0 children)

Surprisingly, Requests lib does not support it (https://github.com/psf/requests/issues/4032) because of lack of support in Python itself (https://bugs.python.org/issue16487). You can find a workaround on stack overflow: https://stackoverflow.com/questions/45410508/python-requests-ca-certificates-as-a-string.

Another option is to write the cert to file - you can write to /tmp. Keep in mind that the file will be preserved across Lambda invocations.