使用RDS实例快照创建Elastic Beanstalk环境(Create Elastic Beanstalk Environment using RDS Instance Snapshot)
我在学习期间使用Elastic Beanstalk上传应用程序,它是团队项目的一部分。 但是,当帐单明细不正确时帐户被暂停,这就中断了应用程序服务。
在使用Amazon解析帐户后,Elastic Beanstalk环境已启动并与RDS实例分开运行。 然后我恢复了最新的RDS备份,但我无法再使用之前的详细信息(主机,DBName和密码)访问MYSQL数据库,并且应用程序不再有效,因为连接到数据库的详细信息是错误的。
然后我发现我不能在现有EB环境中使用快照RDS实例,所以我正在执行以下步骤:
- 将数据库还原到新的RDS实例。
- 手动备份此新RDS实例。 使用手动RDS备份创建新的Beanstalk环境。
- 测试以确保一切按预期工作。
- 更新URL或DNS以确保将流量路由到新环境
但是我不知道如何做第二步,任何人都可以帮助我如何使用RDS实例快照创建一个新的EB环境?
(所以我可以访问数据库)
I used Elastic Beanstalk to upload an application whilst studying, it was part of a group project. However the account got suspended when the billing details were incorrect, this discontinued the application services.
After resolving the account with Amazon the Elastic Beanstalk environment was up and running apart from the RDS instance. I then restored the most recent RDS backup but I can no longer access the MYSQL database with the previous details (Host, DBName and Password) and the application no longer works because the details to connect to the DB are wrong.
I then found out I cannot use a snapshot RDS instance with an existing EB environment, so I am doing the following steps:
- Restore the database to a new RDS instance.
- Make a manual backup of this new RDS instance. Create a new Beanstalk environment using your manual RDS backup.
- Test to make sure everything is working as expected.
- Update URLs or DNS to make sure traffic is routed to your new environment
However I do not know how to do step two, can anybody help me on how to create a new EB environment using an RDS Instance Snapshot ?
(So I can access the DB)
原文:https://stackoverflow.com/questions/38107090
最满意答案
让我们尝试一下。
首先使用
pd.date_range
创建一系列日期,每个记录包含StartDate和EndDate。 下次使用,dt
datetime访问器获取月份。 使用value_counts
计算每条记录的总月数。 最后,将结果加入原始数据框。 另外,通过使用从calendar.month_names
创建的字典rename
,import calendar
以获取月份名称与数字。import calendar df.join(df.apply(lambda x: pd.Series(pd.date_range(x.StartDate, x.EndDate, freq='D')).dt.month,1) .apply(lambda x: x.value_counts(),1) .rename(columns=dict(enumerate(calendar.month_name))))
输出:
StartDate EndDate Days March April May June 0 2018-03-20 00:36:00 2018-05-01 00:42:00 42.004167 12.0 30.0 1.0 NaN 1 2018-05-01 00:42:00 2018-06-04 17:15:38 34.690023 NaN NaN 31.0 4.0 2 2018-04-07 15:06:00 2018-05-09 17:01:00 32.079861 NaN 24.0 9.0 NaN 3 2018-03-21 04:36:00 2018-05-14 04:00:00 53.975000 11.0 30.0 13.0 NaN 4 2018-03-15 15:30:00 2018-05-08 08:30:00 53.708333 17.0 30.0 7.0 NaN 5 2018-05-08 08:30:00 2018-06-09 10:40:09 32.090382 NaN NaN 24.0 9.0 6 2018-03-21 09:00:00 2018-05-16 13:40:00 56.194444 11.0 30.0 16.0 NaN 7 2018-03-31 06:00:00 2018-05-26 16:30:00 56.437500 1.0 30.0 26.0 NaN 8 2018-03-14 18:18:00 2018-04-27 01:00:00 43.279167 18.0 26.0 NaN NaN 9 2018-04-07 15:00:00 2018-06-01 09:25:50 54.767940 NaN 24.0 31.0 NaN 10 2018-03-22 07:30:00 2018-05-20 19:00:00 59.479167 10.0 30.0 20.0 NaN
Lets try this one.
First create a series of days using
pd.date_range
with StartDate and EndDate for each records. Next use,dt
datetime accessor to get the month. Usevalue_counts
to count total months on each record. Lastly, join the results to the original dataframe. Plus,import calendar
to get month name vs number, by usingrename
with a dictionary created fromcalendar.month_names
.import calendar df.join(df.apply(lambda x: pd.Series(pd.date_range(x.StartDate, x.EndDate, freq='D')).dt.month,1) .apply(lambda x: x.value_counts(),1) .rename(columns=dict(enumerate(calendar.month_name))))
Output:
StartDate EndDate Days March April May June 0 2018-03-20 00:36:00 2018-05-01 00:42:00 42.004167 12.0 30.0 1.0 NaN 1 2018-05-01 00:42:00 2018-06-04 17:15:38 34.690023 NaN NaN 31.0 4.0 2 2018-04-07 15:06:00 2018-05-09 17:01:00 32.079861 NaN 24.0 9.0 NaN 3 2018-03-21 04:36:00 2018-05-14 04:00:00 53.975000 11.0 30.0 13.0 NaN 4 2018-03-15 15:30:00 2018-05-08 08:30:00 53.708333 17.0 30.0 7.0 NaN 5 2018-05-08 08:30:00 2018-06-09 10:40:09 32.090382 NaN NaN 24.0 9.0 6 2018-03-21 09:00:00 2018-05-16 13:40:00 56.194444 11.0 30.0 16.0 NaN 7 2018-03-31 06:00:00 2018-05-26 16:30:00 56.437500 1.0 30.0 26.0 NaN 8 2018-03-14 18:18:00 2018-04-27 01:00:00 43.279167 18.0 26.0 NaN NaN 9 2018-04-07 15:00:00 2018-06-01 09:25:50 54.767940 NaN 24.0 31.0 NaN 10 2018-03-22 07:30:00 2018-05-20 19:00:00 59.479167 10.0 30.0 20.0 NaN
相关问答
更多-
计算2个日期之间的月份,然后计算每个月的天数(Calculating months between 2 dates, then calculating days in each month)[2023-12-01]
注意:这不是问题的答案,而是对不同方法的建议。 由于问题是关于一个人在一段时间内的膳食数量,我认为接近这一点的自然方式(至少代表数据)是按天而不是按月进行。 (从视觉上看,数据可能必须按月表示,但首先按天计算数据然后按月呈现数据要容易得多。) 由于问题相当模糊,我对数据做了一些假设。 该类可用于存储有关一天的信息。 class DayEntry { public DateTime Date { get; set; } public string MonthName { get; set; } ... -
循环日期范围子+将天数分配给各自的月份(Looping a date range sub + allocate days to their respective months)[2024-03-01]
让我们尝试一下。 首先使用pd.date_range创建一系列日期,每个记录包含StartDate和EndDate。 下次使用, dt datetime访问器获取月份。 使用value_counts计算每条记录的总月数。 最后,将结果加入原始数据框。 另外,通过使用从calendar.month_names创建的字典rename , import calendar以获取月份名称与数字。 import calendar df.join(df.apply(lambda x: ... -
PHP中的日期范围到月份(Date range to months in PHP)[2023-07-23]
那么你在if子句中分配变量......单个“=”分配。 我假设你要检查所以你需要“==”:) if (!empty($daydiff) && $ArrivalDate == '2013-12-25') { $ETA ='Date Not Confirmed'; } elseif (is_null($ArrivalDate) || $ArrivalDate == 'NULL') { $ETA ='Not available'; } Well you are assign variables ... -
日期以PHP为单位(Days range as months in PHP)[2021-09-20]
尝试 $ArrivalDate = $variants_data['ArrivalDate']; if (!empty($ArrivalDate)){ $ArrivalDate = date('Y-m-d', strtotime($ArrivalDate)); $daydiff=floor(abs(strtotime(date("Y-m-d")) - strtotime($ArrivalDate)) / (60*60*24)); echo $daydiff; ... -
如何在c#中表示没有31天的月份的日期范围?(How do I represent date range for months that donot have 31 days in c#?)[2022-07-12]
你可以这样做: DateTime end = first.AddMonths(1).AddDays(-1); You could do something like this: DateTime end = first.AddMonths(1).AddDays(-1); -
将日期分配给周ID(Allocate Dates to Week IDs)[2021-12-29]
正如@ sp00m所说:你可以使用日历 。 Calendar cal = Calendar.getInstance(); cal.set(Calendar.WEEK_OF_YEAR, 4); int week = cal.get(Calendar.WEEK_OF_YEAR); 你可以从日历中获得很多参数 as @sp00m mentioned it: you can use a Calendar. Calendar cal = Calendar.getInstance(); cal.set(Calenda ... -
使用datetime.datetime.timedelta() ; 简单地减去两个日期: delta = end_financial_month - from_day return delta.days Use datetime.timedelta(); simply subtract the two dates: delta = end_financial_month - from_day return delta.days
-
获得两个约定日期之间的准确年份,日期或月份[复制](Getting the exact years or days or months between two joda date [duplicate])[2023-12-08]
您可以保留一个列表并根据您的差异来填充它。 我已经实施了一种方法来提供一个想法: private static LinkedList yearLister(int yearCount, int startingYear, int endYear){ LinkedList years = new LinkedList(); if (yearCount < 0){ yearCount = -yearCount; } // yearCount can be negative. ... -
日期范围内的天数(Number of days in date range)[2023-09-10]
从您提到的结果来看,Excel并未意识到数字代表日期。 你的方法可以在一个月内完成,因为比如说第15天比第10天提前5天,而下个月的15号比本月10日提前5天。 因此,为了能够从其他Excel中减去一个,需要知道这些数字代表日期,这可以通过各种方式实现,其中一个具有以下类型的公式: =DATE(LEFT(A1,4),MID(A1,5,2),RIGHT(A1,2)) 如果只是采取差异就做了这样的转换应该提供你想要的结果,例如7而不是76 (来自603 - 527)。 Judging from the r ... -
您仍然可以使用perl或python oneliners执行此操作,例如,从当前日期减去一天: $ date Thu May 14 15:31:49 MEST 2015 $ python -c "from datetime import datetime, timedelta; print (datetime.now() - timedelta(1)).strftime('%c');" Wed May 13 15:31:58 2015 you still can do this with perl or ...