F5Networks / f5-aws-cloudformation-v2

AWS Cloudformation Templates for quickly deploying BIG-IP services in AWS
13 stars 22 forks source link

Deploying CFT in Tel Aviv (il-central-1) fails #53

Open mikeoleary opened 3 months ago

mikeoleary commented 3 months ago

Describe the bug

It appears that we cannot deploy the CFT in region il-central-1. Can we get support for this?

Expected behavior

CFT to deploy new stack will work.

Current behavior

Customer cannot deploy into Tel Aviv region (il-central-1). He gets the following error when trying the template for a Failover pair into a NEW VPC:

Resource handler returned message: "User: arn:aws:sts::xxxxxxxxxxxx:assumed-role/xxx/xxx@company.com is not authorized to perform: lambda:GetLayerVersion on resource: arn:aws:lambda:il-central-1:xxxxxxxxxxxx:layer:Klayers-p312-requests:3 because no resource-based policy allows the lambda:GetLayerVersion action (Service: Lambda, Status Code: 403, Request ID: xxx)" (RequestToken: xxx, HandlerErrorCode: AccessDenied)

Customer says he was able to get around this by creating a bucket specifically for himself and copying our templates into it. However, after that, he got a new error:

2024-07-01T12:08:56.958Z [9032]: error: AWS Cloud Client secret id arn:aws:secretsmanager:il-central-1:xxxxxxxxx:secret:xxxxxf5-bigIpSecret-xxxxxx is the wrong format

However, we double-checked this secret and it is in the correct format. (Secret itself is a string of letters and numbers without illegal special characters. IAM role allows permissions to secret).

Steps to reproduce

Deploy CFT into il-central-1

Note I cannot test in this region (il-central-f5) with my F5 account. I am unable to replicate customer's problem because of this.

mikeshimkus commented 3 months ago

Hi @mikeoleary, I created issue EC-526 for this, but cannot start work on it yet because our account also needs access to that region (it's been requested).

That said, for the first error you should have been able to get around it by providing an AMI for the bigIpCustomImageId parameter since looking up the AMI by name is the only thing GetLayerVersion is used for.

The second error is from runtime init. The validator for the secret ARN doesn't include any il regions and the one for simple secret name doesn't support uppercase. There are two options to work around this until we can fix:

  1. Leave the secret ID parameter empty so that the template creates a new secret with a random value (see https://github.com/F5Networks/f5-aws-cloudformation-v2/blob/main/examples/failover/README.md#important-configuration-notes for info on that)
  2. Recreate the existing secret, but make sure the name is all lowercase, e.g. xxxxxf5-bigipsecret-xxxxxx. Then use that non-ARN value for the bigIpSecretArn input. Note that it may be required to create an instance profile prior to deploying for this to work.
mikeoleary commented 3 months ago

@mikeshimkus, big thank you as always. I have asked customer to try this and also to subscribe to this issue.

shiv-dasari commented 3 months ago

bigIpCustomImageId: we used these AMIs--ami-084b3f263e7cff637 / ami-0e38f7892a301a8ca

Leave the secret ID parameter empty so that the template creates a new secret with a random value: yes we tried in call @mikeoleary

Then use that non-ARN value for the bigIpSecretArn input. : need assistance here

mikeshimkus commented 3 months ago

@shiv-dasari The options are either leave the secret ID empty or use non-ARN value for bigIpSecretArn (the latter assumes you have already created the secret).

We are going to release an update to F5 BIG-IP Runtime Init that should fix the issue with using the existing secret. I will post here when it's available.

mikeshimkus commented 2 months ago

Hi @shiv-dasari, for the secret ARN issue, please try updating the bigIpRuntimeInitPackageUrl parameter to https://cdn.f5.com/product/cloudsolutions/f5-bigip-runtime-init/v2.0.3/dist/f5-bigip-runtime-init-2.0.3-1.gz.run and then redeploy.

shiv-dasari commented 2 months ago

@mikeshimkus ---we are seeing this error- Resource handler returned message: "User: arn:aws:sts::068900102323:assumed-role/AWS_DCS_NetworkingAdmin/usa-shivshiva@deloitte.com is not authorized to perform: lambda:GetLayerVersion on resource: arn:aws:lambda:il-central-1:770693421928:layer:Klayers-p312-requests:3 because no resource-based policy allows the lambda:GetLayerVersion action (Service: Lambda, Status Code: 403, Request ID: db0fa450-3c54-43ca-9a82-98f196c0d2b3)" (RequestToken: 44adda57-3da7-95d2-1370-5239df6a8179, HandlerErrorCode: AccessDenied)

shiv-dasari commented 2 months ago

We don not have visibility/access to this account arn:aws:lambda:il-central-1:770693421928:layer:Klayers-p312-requests:3

mikeshimkus commented 2 months ago

For the GetLayerVersion error, you will either need to use the AMI ID for bigIpCustomImageId, or grant the required permissions to arn:aws:lambda:il-central-1:770693421928:layer:Klayers-p312-requests:3 in your IAM policy (the latter is only required when using the AMI lookup function, which should be bypassed if you provide bigIpCustomImageId.

shiv-dasari commented 2 months ago

@mikeshimkus --Thank you I have full access on my account

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "", "Resource": "" } ]

AdministratorAccess | AWS managed - job function

I think it should be allowed on 770693421928: this account.

shiv-dasari commented 2 months ago

@mikeshimkus and @mikeoleary -- We were using this Image ID- in our last / even I checked again same error. bigIpCustomImageId | ami-0e38f7892a301a8ca

-

mikeshimkus commented 2 months ago

@shiv-dasari Looks like your IAM policy needs to allow lambda:GetLayerVersion

Example: https://github.com/F5Networks/f5-aws-cloudformation-v2/blob/ea11c96511a69435b7818ce3337709acc16e0230/examples/modules/access/access.yaml#L464

shiv-dasari commented 2 months ago

@mikeoleary --Need your assistance, can we connect on Monday. Please let me know.

mikeoleary commented 2 months ago

@shiv-dasari - ok will email you.

shiv-dasari commented 2 months ago

@mikeshimkusWe were able to add the Function stack to our S3 and run it, but we are still encountering this issue with the last stack (VM the building phase).

2024-07-16 20:03:18 UTC+0530 | ill-f5-stack-BigIpInstance02-1KORPCAEL3P6Q | CREATE_FAILED | The following resource(s) failed to create: [Bigip3NicInstance].

-- | -- | -- | --

2024-07-16 20:03:18 UTC+0530 | Bigip3NicInstance | CREATE_FAILED | Failed to receive 1 resource signal(s) within the specified duration

shiv-dasari commented 2 months ago

AWSTemplateFormatVersion: '2010-09-09' Description: >- This template creates BIG-IP PAYG or BYOL High Availability WAF solution. The template uses nested templates for provisioning network, access, and compute resources for hosting BIG-IP Failover solution. Metadata: AWS::CloudFormation::Interface: ParameterGroups:

shiv-dasari commented 2 months ago

I am using this parent stack in AWS Israel region

And I added Function stack template into our S3 , then after we were able to ran with out any issue but still failing.

mikeshimkus commented 2 months ago

@shiv-dasari Do you have ssh access to the BIG-IP(s)? If yes can you share the content of /var/log/cloud/startup-script.log?

shiv-dasari commented 2 months ago

@mikeoleary --I have sent the requested below logs over email. var/log/cloud-init-output.log

/var/log/cloud/bigipruntimeinit.log /var/log/cloud/startup-script.log

/config/cloud/runtime-init.conf

shiv-dasari commented 2 months ago

@mikeshimkus , please find for the /var/log/cloud/startup-script.log [Uploading putty.log…]()