localstack / serverless-localstack

⚡ Serverless plugin for running against LocalStack
511 stars 82 forks source link

Use awslocal from my host to localstack and use it into localstack container #250

Closed Laurent45 closed 2 months ago

Laurent45 commented 3 months ago

Hello everyone. I'm a little bit confused. I deployed an apiGateway with serverless-localstack and everything is done successfully. When I check my APG with this command

awslocal apigateway get-rest-apis

I have two different results according to my place. When I run this command in my host, I have this result:

{
    "items": []
}

And when I run this in the localstack container, I have this:

{
    "items": [
        {
            "id": "hlbyuah2x3",
            "name": "OcBridgeApi",
            "createdDate": 1711038902.0,
            "apiKeySource": "HEADER",
            "endpointConfiguration": {
                "types": [
                    "EDGE"
                ]
            },
            "tags": {
                "aws:cloudformation:logical-id": "OcBridgeApi",
                "aws:cloudformation:stack-name": "users-dev",
                "aws:cloudformation:stack-id": "arn:aws:cloudformation:us-east-1:000000000000:stack/users-dev/b5c34ab6"
            },
            "disableExecuteApiEndpoint": false
        }
    ]
}

Can somebody please explain it to me, please?

steffyP commented 2 months ago

Hi @Laurent45,

it sounds like you maybe have a different default region set on your local machine vs in the container. Your stack-id in the container contains us-east-1 so my guess that this is the region you deployed it to?

Try running the command locally with the region set, e.g. awslocal apigateway get-rest-apis --region us-east-1 Let us know if this works!

Laurent45 commented 2 months ago

Hi @steffyP, Thank you very much. Indeed the AWS region was the problem. ☺️